clean up unused Python imports (#454)

* Remove unused python imports

These changes have been auto-generated with:

	pip3 install isort autoflake
	isort -rc -sl .
	autoflake --remove-all-unused-imports -i -r .
	isort -rc -m 3 .

Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>

* python: remove redundant parenthesis

Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
This commit is contained in:
Radostin Stoyanov
2022-02-24 16:31:53 +00:00
committed by GitHub
parent 50f397b249
commit d84179e42f
36 changed files with 176 additions and 170 deletions

View File

@@ -1,14 +1,20 @@
#!/usr/bin/env python3
import sys
import struct
import os
import sys
from scapy.all import sniff, sendp, hexdump, get_if_list, get_if_hwaddr
from scapy.all import Packet, IPOption
from scapy.all import ShortField, IntField, LongField, BitField, FieldListField, FieldLenField
from scapy.all import IP, TCP, UDP, Raw
from scapy.all import (
TCP,
FieldLenField,
FieldListField,
IntField,
IPOption,
ShortField,
get_if_list,
sniff
)
from scapy.layers.inet import _IPOption_HDR
def get_if():
ifs=get_if_list()
iface=None
@@ -44,7 +50,7 @@ def handle_pkt(pkt):
def main():
ifaces = [i for i in os.listdir('/sys/class/net/') if 'eth' in i]
iface = ifaces[0]
print(("sniffing on %s" % iface))
print("sniffing on %s" % iface)
sys.stdout.flush()
sniff(iface = iface,
prn = lambda x: handle_pkt(x))

View File

@@ -1,13 +1,10 @@
#!/usr/bin/env python3
import argparse
import sys
import socket
import random
import struct
import socket
import sys
from scapy.all import IP, TCP, Ether, get_if_hwaddr, get_if_list, sendp
from scapy.all import sendp, send, get_if_list, get_if_hwaddr
from scapy.all import Packet
from scapy.all import Ether, IP, UDP, TCP
def get_if():
ifs=get_if_list()
@@ -30,7 +27,7 @@ def main():
addr = socket.gethostbyname(sys.argv[1])
iface = get_if()
print(("sending on interface %s to %s" % (iface, str(addr))))
print("sending on interface %s to %s" % (iface, str(addr)))
pkt = Ether(src=get_if_hwaddr(iface), dst='ff:ff:ff:ff:ff:ff')
pkt = pkt /IP(dst=addr) / TCP(dport=1234, sport=random.randint(49152,65535)) / sys.argv[2]
pkt.show2()