-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathripper-cli.py
71 lines (60 loc) · 2.93 KB
/
ripper-cli.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
from ripper.Ripper import Ripper
import getopt
import sys
def main(argv):
banner()
dictionary = None
use_tor = False
user = None
users = None
session = None
try:
opts, args = getopt.getopt(argv, "d:u:htf:s:", ["dictionary=", "user=", "help", "use-tor", "users-file=",
"session-file="])
except getopt.GetoptError as err:
print(err)
usage()
for opt, arg in opts:
if opt in ('-h', "--help"):
usage()
quit()
if opt in ('-d', "--dictionary"):
dictionary = arg
if opt in ("-t", "--use-tor"):
use_tor = True
if opt in ("-u", "--user"):
user = arg
if opt in ("-f", "--users-file"):
users = arg
if opt in ("-s", "--session"):
session = arg
if users is None and user is None and session is None:
usage()
ripper = Ripper(target=user, targets=users, dictionary=dictionary, use_tor=use_tor, session=session)
ripper.execute()
def usage():
print("MoodleRipper v0.2:\n")
print("usage: {} [arguments]\n".format(sys.argv[0]))
print("Arguments:")
print(" -h, --help Prints this message.")
print(" -u, --user=<string> Specify user's name to login.")
print(" -f, --users_file=<file> Load user names from text file.")
print(" -d, --dictionary=<file> Filename of desired dictionary, if it isn't specified default will be used.")
print(" -t, --use-tor Connect via Tor.")
print(" -s, --session=<file> Load session file.\n")
print("Configuration:")
print("Configuration options are in 'config.json' file. In this file you can change tor address, target address,")
print("modify path of the login page and add or modify login parameters (default file has moodle defaults). ")
quit()
def banner():
art = " __..._ _...__ ,__ __ _ , __ \n"
art += " _..-\" `Y` \"-._ /| | | | | | /|/ \ o \n"
art += " \ | / | | | __ __ __| | | _ |___/ _ _ _ ,_ \n"
art += " \\ | // | | | / \_ / \_ / | |/ |/ | \ | |/ \_ |/ \_ |/ / | \n"
art += " \\\ | /// | | |_/ \__/ \__/ \_/|_/ |__/ |__/ | \_/ |_/ |__/ |__/ |__/ |_/\n"
art += " \\\ _..---.|.---.._ /// /| /| \n"
art += " \\`_..---.Y.---.._`// by @iordic \| \| \n"
art += " '` `' \n"
print(art)
if __name__ == "__main__":
main(sys.argv[1:])