Repository navigation
Expand file tree
/
Copy pathgitlab-enum.py
More file actions
64 lines (49 loc) · 2.24 KB
/
Copy pathgitlab-enum.py
File metadata and controls
64 lines (49 loc) · 2.24 KB
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
#!python3
import requests
import sys
import argparse
import math
from concurrent.futures import ThreadPoolExecutor
BANNER=r"""
_____ _____ _____ _ ___ ______ _____ _ _ _ ____ ___
| __ \_ _|_ _| | / _ \ | ___ \ | ___| \ | | | | | \/ |
| | \/ | | | | | | / /_\ \| |_/ / | |__ | \| | | | | . . |
| | __ | | | | | | | _ || ___ \ | __|| . ` | | | | |\/| |
| |_\ \_| |_ | | | |____| | | || |_/ / | |___| |\ | |_| | | | |
\____/\___/ \_/ \_____/\_| |_/\____/ \____/\_| \_/\___/\_| |_/
"""
parser = argparse.ArgumentParser(prog="gitlab-enum",description="Simple enumeration tools for gitlab users")
parser.add_argument("-v","--verbose", help="increase output verbosity", action="store_true")
parser.add_argument("-q","--quiet", help="Don't show the banner", action="store_true")
parser.add_argument("url", help="Gitlab URL (without PATH)")
parser.add_argument("-u","--users", help="User file", required=True)
parser.add_argument("-t","--threads",type=int, help="Number of threads", default=2)
args = parser.parse_args()
URL = "http://gitlab.inlanefreight.local:8081"
VERBOSE=args.verbose
def load_wordlist(filepath,splitted=1) :
lists = []
with open(filepath, newline='', mode="r") as f :
lines = [w.strip() for w in f.readlines()]
splitted = min(splitted, len(lines))
filePerSplit= math.ceil(len(lines)/splitted)
for i in range(0,splitted) :
lists.append(lines[filePerSplit*i:min(len(lines),filePerSplit*(i+1))])
return lists
def is_user_exist(user) :
res = requests.get(f"{args.url}/users/{user}/exists")
if VERBOSE :
print(f"[NO]{user}")
return res.json()["exists"]
def test_dataset(users) :
for u in users :
if is_user_exist(u) :
print(f"[EXIST] {u}")
user_files = load_wordlist(args.users, args.threads)
if not args.quiet :
print(BANNER)
print(f"Thread number = {args.threads}")
print(f"User per thread = {len(user_files[0])}")
with ThreadPoolExecutor(max_workers=args.threads) as executor :
for i in range(0,args.threads):
executor.submit(test_dataset,user_files[i])