forked from 4n0nh3r0/Weevely-Termux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
weevely.py
88 lines (59 loc) · 2.38 KB
/
weevely.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
#!/usr/bin/env python
# This file is part of Weevely NG.
#
# Copyright(c) 2011-2012 Weevely Developers
# http://code.google.com/p/weevely/
#
# This file may be licensed under the terms of of the
# GNU General Public License Version 2 (the ``GPL'').
#
# Software distributed under the License is distributed
# on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
# express or implied. See the GPL for the specific language
# governing rights and limitations.
#
# You should have received a copy of the GPL along with this
# program. If not, go to http://www.gnu.org/licenses/gpl.html
# or write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from core.terminal import Terminal, module_trigger, help_string
from core.modulehandler import ModHandler
from core.moduleexception import ModuleException
from core.helper import banner, credits, usage
import sys
import os
if __name__ == "__main__":
if len(sys.argv) >= 3 and (sys.argv[1].startswith('http') or sys.argv[1] == 'session'):
url = None
password = None
sessionfile = None
if sys.argv[1].startswith('http'):
url = sys.argv[1]
password = sys.argv[2]
else:
sessionfile = sys.argv[2]
try:
module_handler = ModHandler(url=url, password=password, sessionfile=sessionfile)
if len(sys.argv) == 3:
Terminal (module_handler).loop()
else:
Terminal(module_handler).run_cmd_line(sys.argv[3:])
except ModuleException, e:
print '[!] [%s] %s ' % (e.module, e.error)
except (KeyboardInterrupt, EOFError):
print '\n[!] Exiting. Bye ^^'
elif len(sys.argv) >= 3 and sys.argv[1].startswith('generate'):
genname = sys.argv[1]
password = sys.argv[2]
if genname == 'generate':
genname = 'generate.php'
try:
Terminal (ModHandler()).run_cmd_line([':%s' % genname ] + sys.argv[2:])
except ModuleException, e:
print '[!] [%s] %s ' % (e.module, e.error)
elif len(sys.argv) >= 2 and sys.argv[1] == 'help':
Terminal (ModHandler()).run_cmd_line([':help' ] + sys.argv[2:])
elif len(sys.argv)==2 and sys.argv[1] == 'credits':
print credits
else:
print banner, usage