-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgitwiki.py
More file actions
30 lines (28 loc) · 1.2 KB
/
gitwiki.py
File metadata and controls
30 lines (28 loc) · 1.2 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
import requests,json,argparse
from bs4 import BeautifulSoup
import time
parser = argparse.ArgumentParser()
parser.add_argument('--target', action='store', dest='target', help='Specify the target github user.')
parser.add_argument('--token', action='store', dest='apikey', help='Specify your github api key')
parser.add_argument('--cookie', action='store', dest='cookie', help='Specify github cookie')
results = parser.parse_args()
target = results.target
apikey = results.apikey
cookie = results.cookie
page = 1
loop = True
file
while loop == True:
queryurl = "https://api.github.com/users/{0}/repos?page={1}&per_page=100?access_token={2}".format(target,page,apikey)
r = requests.get(queryurl, headers={'Authorization': 'token {0}'.format(apikey)})
response = r.json()
if "name" in r.text:
page += 1
for repos in response:
url = "https://github.com/{0}/{1}/wiki/_new".format(target,repos["name"])
n = requests.get(url,headers={'Cookie': cookie})
if "Create new page" in n.text:
print("https://github.com/{0}/{1}/wiki/new".format(target,repos["name"]))
else:
print(response)
loop = False