File tree 2 files changed +26
-7
lines changed
2 files changed +26
-7
lines changed Original file line number Diff line number Diff line change @@ -48,19 +48,34 @@ def __init__(self):
48
48
f .write (data )
49
49
if not os .path .exists (self .domain ):
50
50
os .mkdir (self .domain )
51
+ self .dest_dir = os .path .abspath (self .domain )
51
52
self .queue = Queue .Queue ()
52
53
for entry in parse ('index' ):
53
54
if "sha1" in entry .keys ():
54
- if entry ["name" ].strip ().find ('..' ) < 0 :
55
- self .queue .put ((entry ["sha1" ].strip (), entry ["name" ].strip ()))
56
- try :
57
- print ('[+] %s' % entry ['name' ])
58
- except Exception as e :
59
- pass
55
+ entry_name = entry ["name" ].strip ()
56
+ if self .is_valid_name (entry_name ):
57
+ self .queue .put ((entry ["sha1" ].strip (), entry_name ))
58
+ try :
59
+ print ('[+] %s' % entry ['name' ])
60
+ except Exception as e :
61
+ pass
62
+
60
63
self .lock = threading .Lock ()
61
64
self .thread_count = 10
62
65
self .STOP_ME = False
63
66
67
+ def is_valid_name (self , entry_name ):
68
+ if entry_name .find ('..' ) >= 0 or \
69
+ entry_name .startswith ('/' ) or \
70
+ entry_name .startswith ('\\ ' ) or \
71
+ not os .path .abspath (os .path .join (self .domain , entry_name )).startswith (self .dest_dir ):
72
+ try :
73
+ print ('[ERROR] Invalid entry name: %s' % entry_name )
74
+ except Exception as e :
75
+ pass
76
+ return False
77
+ return True
78
+
64
79
@staticmethod
65
80
def _request_data (url ):
66
81
request = urllib2 .Request (url , None , {'User-Agent' : user_agent })
Original file line number Diff line number Diff line change 1
1
# GitHack
2
2
3
3
4
+ ### This is important
5
+ ### All users please git pull to update source code. (2022-05-09)
6
+
4
7
GitHack is a ` .git ` folder disclosure exploit.
5
8
6
9
It rebuild source code from .git folder while keep directory structure unchanged.
@@ -11,7 +14,8 @@ GitHack是一个.git泄露利用脚本,通过泄露的.git文件夹下的文
11
14
12
15
## Change Log
13
16
14
- * 2022-04-07:Fix abitrary file write vulnerability. Thanks for [ @justinsteven ] ( https://github.com/justinsteven ) \' s bug report, it's very helpful.
17
+ * 2022-05-09: Bug fix, thanks [ @justinsteven ] ( https://github.com/justinsteven ) .
18
+ * 2022-04-07:Fix arbitrary file write vulnerability. Thanks for [ @justinsteven ] ( https://github.com/justinsteven ) \' s bug report, it's very helpful.
15
19
* 2022-04-07:Add python3.x support
16
20
17
21
## How It works ##
You can’t perform that action at this time.
0 commit comments