Skip to content

Problems with sonata's example #40

@Polly2014

Description

@Polly2014

Recently I was trying run sonata's example, it's really cool, but I found that the examples has a little problem

  1. In the syn_flood example, the code in send.py is not like syn_flood attack, it's more like a UDP's attack as below:
def create_attack_traffic():
    number_of_packets = ATTACK_PACKET_COUNT
    dIP = '99.7.186.25'
    sIPs = []
    attack_packets = []
    for i in range(number_of_packets):
        sIPs.append(socket.inet_ntoa(struct.pack('>I', random.randint(1, 0xffffffff))))
    for sIP in sIPs:
        p = Ether() / IP(dst=dIP, src=sIP) / UDP(sport=53)/DNS(nscount=1, ns=DNSRR(type=46))
        # print p.show()
        # print sIP, p.proto, p.sport, p.ns.type
        # print len(str(p)), "Ether(): ", len(str(Ether())), "IP: ", len(str(IP(dst=dIP, src=sIP))), \
        #     "UDP: ",len(str(UDP(sport=53))),"DNS: ", len(str(DNS(nscount=1, ns=DNSRR(type=46)))), "\n"
        attack_packets.append(p)
    return attack_packets
  1. In the superspreader's example, I find the code in it more like tcp syn_flood attack:
def create_attack_traffic():
    number_of_packets = ATTACK_PACKET_COUNT
    sIP = '99.7.186.25'
    dIPs = []
    attack_packets = []
    for i in range(number_of_packets):
        dIPs.append(socket.inet_ntoa(struct.pack('>I', random.randint(1, 0xffffffff))))
    dport = 0
    for dIP in dIPs:
        dport += 1
        p = Ether() / IP(dst=dIP, src=sIP) / TCP(dport=dport, flags='S')
        attack_packets.append(p)
    return attack_packets
  1. When I run syn_flood example test_app.py, it show some error as below:
*********************************************************************
*                   Updating Streaming Driver                       *
*********************************************************************


WEIRD
WEIRD
Exception in thread streaming_driver:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 763, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/home/vagrant/dev/sonata/core/runtime.py", line 383, in start_streaming_driver
    sm.start()
  File "/home/vagrant/dev/sonata/streaming_driver/streaming_driver.py", line 55, in start
    self.process_pktstream(pktstream)
  File "/home/vagrant/dev/sonata/streaming_driver/streaming_driver.py", line 94, in process_pktstream
    eval(join_query)
  File "<string>", line 1
    spark_queries[10032].join(spark_queries[20032]).map(lambda ((ipv4_dstIP),(count_right,count_left)): (),))).foreachRDD(lambda rdd:send_reduction_keys(rdd, [u'localhost', 4949],1567610220.96,'40032'))
                                                                                                            ^
SyntaxError: invalid syntax

Maybe I understood wrong, hope you can give me some help, thx

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions