-
-
Notifications
You must be signed in to change notification settings - Fork 291
/
lockdoor
executable file
·178 lines (176 loc) · 7.49 KB
/
lockdoor
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
#!/usr/bin/python3
#Bismillah <3
import sys
import os
from os import path
import time
import socket
import urllib.request, urllib.parse, urllib.error
import atexit
import requests
from pathlib import Path
#req
import base64
from sys import argv
from sys import platform
from platform import system
from urllib.parse import urlparse
from time import sleep
from datetime import datetime
from lockdoors import shrts
###Variables
yes = set(['yes', 'y', 'ye', 'Y'])
no = set(['no', 'n', 'nop', 'N'])
cwd = os.getcwd()
Version = "2.3"
verbose = yes
config = str(Path.home()) + "/.config/lockdoor/"
#Print Logo
def printlogo():
print("""
\033[94m ..',,,'.. \033[0m
\033[94m .',;;;;;;;;,'. \033[0m
\033[94m ..,;;;;;;;;;;;;;;,.. \033[0m
\033[94m .,;;;,'..'''''.',;;;,. \033[0m
\033[94m .;;;;. .. .. .;;;;' \033[0m\033[91m ( \033[0m
\033[94m .,;;;. ... .;;;;. \033[0m\033[91m )\ ) ) ( \033[0m
\033[94m ..,;,. ... .,;,.. \033[0m\033[91m (()/( ( /( )\ ) ( \033[0m
\033[94m .';;'. .',;'. \033[0m\033[91m /(_)) ( ( )\())(()/( ( ( )( \033[0m
\033[94m ..',,;;;;;,,,,;;;;;,,'.. \033[0m\033[91m (_)) )\ )\ ((_)\ ((_)) )\ )\ (()\ \033[0m
\033[94m .','.....................''. \033[0m\033[91m | | ((_) ((_)| |(_) _| | ((_) ((_) ((_)\033[0m
\033[94m .',..',,,,,,,,,,,,,,,,,,,..,,. \033[0m\033[91m | |__ / _ \/ _| | / // _` |/ _ \/ _ \| '_|\033[0m
\033[94m .;,..,;;;;;;'....';;;;;;;..,;. \033[0m\033[91m |____|\___/\__| |_\_\\__,_|\___/\___/|_| \033[0m
\033[94m ';;..,;;;;;,..,,..';;;;;,..,;' \033[0m\033[92m © Sofiane Hamlaoui | 2024 \033[0m
\033[94m.';;..,;;;;,. .... .,;;;;,..;;,. \033[0m\033[92m Lockdoor : A Penetration Testing framework\033[0m
\033[94m ';;..,;;;;' .... .;;;;,..;;,. \033[0m\033[92m v2.3 \033[0m
\033[94m .,;'.';;;;'. .. .';;;;,.';,. \033[0m
\033[94m ....;;;;;,'''''',;;;;;'... \033[0m
\033[94m .................. \033[0m
""")
def getinstalldir():
f = open(config + 'lockdoor.conf')
contents = f.read().rstrip('\n')
f.close()
getinstalldir.installdirc = contents.replace('Location:', '')
def checkroot():
shrts.prilogspc()
#Linux
if platform == "linux" or platform == "linux2":
if os.geteuid() != 0:
print(" \033[1;33;40m-[!]- This Tool Must Run As ROOT -[!]-\033[0m")
sys.exit()
else:
print(" \033[1;33;40m-[!]- Running As ROOT -[!]-\033[0m")
#Cygwin
elif platform == "cygwin":
print(" \033[1;33;40m-[!]- Running As ROOT -[!]-\033[0m")
def confirmlocation():
getinstalldir()
confirm = input("\033[91m[!]\033[0m \033[94mThe Installation directory is : " + "\033[92m" + getinstalldir.installdirc + "\033[90m" + "\033[94m" + " Confirm ? (Y/N) : \033[91m")
if not confirm in no:
shrts.spc()
print(" \033[94m Installation directory confirmed \033[0m" + "\033[92m" + getinstalldir.installdirc + "\033[90m")
shrts.spc()
shrts.oktocont()
shrts.clr()
else:
shrts.spc()
print(" remove all files on \033[94m'/usr/local/bin\033[90m \033[92m(grep -l Sofiane /usr/local/bin/* | xargs sudo rm)\033[90m")
shrts.spc()
print(" Change the installation directory from the configuration file \033[90m(\033[92m" + config + "lockdoor.conf \033[90m)")
confirmlocation()
def checkconnect():
shrts.spc()
url='http://www.google.com/'
try:
_ = requests.get(url, timeout=1)
return True
except requests.ConnectionError:
print(" \033[1;33;40m-[!]- YOU NEED INTERNET CONNECTION TO RUN LOCKDOOR -[!]-\033[0m")
sys.exit()
return
def vercheck():
with urllib.request.urlopen('https://raw.githubusercontent.com/SofianeHamlaoui/Lockdoor-Framework/master/VERSION') as response:
resp = str(response.read())
if Version in resp:
print(" \033[92m[!]\033[0m \033[94m LOCKDOOR IS UP TO DATE \033[0m \033[92m[!]\033[0m")
else:
ans = input(" \033[91m[!]\033[0m \033[94mLOCKDOOR ISN'T UP TO DATE ! UPDATE IT ? (Y/N) : \033[0m")
shrts.spc()
if not ans in yes:
print(" \033[91m[!]\033[0m \033[94mLOCKDOOR IS OUTDATED \033[0m")
else:
from lockdoors import update
update.lockdoor()
def updatingtools():
shrts.spc()
printlogo()
confirm = input("\033[91m[!]\033[0m \033[94mDo you want to update the installed tools ?: " + "\033[94m(Y/N) : \033[91m")
if not confirm in no:
print("\033[92mUpdating The Tools...\033[90m")
shrts.spc()
getinstalldir()
os.system('sudo find ' + getinstalldir.installdirc + ' -type d -name .git -exec sh -c "cd \"{}\"/../ && pwd && git pull origin master" \;')
shrts.spc()
shrts.oktocont()
shrts.clr()
def checkconf():
if os.path.isfile('/root/.config/lockdoor/lockdoor.conf') == False:
shrts.spc()
print("\033[91m Lockdoor Config not file found!\033[0m")
shrts.spc()
confirm = input("\033[91m[!]\033[0m \033[94mDo you want to run the installation script ?: " + "\033[94m(Y/N) : \033[91m")
if not confirm in no:
shrts.spc()
print("\033[92mInstalling Lockdoor with requirments...\033[90m")
shrts.spc()
os.system("curl -L https://lockdoor-framework.github.io/install.sh > install.sh && chmod +x install.sh && ./install.sh")
shrts.spc()
shrts.oktocont()
shrts.clr()
else:
shrts.spc()
print("NO? so you have to download lockdoor from Github and run the install script [\033[94mhttps://git.io/JeDay\033[91m]")
sys.exit()
else:
shrts.spc()
print("\033[92m -[!]- Lockdoor Config file found!-[!]- \033[91m")
# incase brk ak chayef :v
if (" ".join(sys.argv[1:]) == "--version") or (" ".join(sys.argv[1:]) == "-v"):
with urllib.request.urlopen('https://raw.githubusercontent.com/SofianeHamlaoui/Lockdoor-Framework/master/VERSION') as response:
resp = str(response.read().decode('utf-8'))
shrts.prilogspc()
print("\033[94m This version of Lockdoor is v" + resp +"\033[91m")
sys.exit()
#INIT
def init():
checkroot()
checkconf()
checkconnect()
confirmlocation()
updatingtools()
shrts.spc()
printlogo()
vercheck()
shrts.spc()
if __name__ == "__main__":
try:
init()
from lockdoors import main
main.menu()
except (KeyboardInterrupt):
shrts.spc()
shrts.spc()
ans = input(" \033[91m-[!]- SIGINT or CTRL-C detected. Are You sure to exit \033[92mLockdoor \033[90m\033[91m-[!] ? (Y/N)\033[0m : ")
if not ans in yes:
from lockdoors import main
main.menu()
else:
shrts.clr()
printlogo()
now = datetime.now()
dt_string = now.strftime("%d/%m/%Y %H:%M:%S")
print(" \033[91m-[!]- LOCKDOOR IS EXITING -[!]-\033[0m")
shrts.spc()
print(" \033[91m-[!]- EXITING AT " + dt_string + " -[!]-\033[0m")
sys.exit()