This repository was archived by the owner on Nov 21, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathgithub_hack.pl
More file actions
198 lines (164 loc) · 4.22 KB
/
github_hack.pl
File metadata and controls
198 lines (164 loc) · 4.22 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
#!/usr/bin/perl -io
=pod
This is github crawler,
to help you on github hacks.
Before to run,
you need install some Perl modules:
$ cpan -i LWP
$ cpan -i URI
$ cpan -i Term::ANSIColor
$ cpan -i LWP::Protocol::https
$ perl github_crawler.pl
Example to use:
$ perl github_hack.pl password login out.txt 2
password = string to search on github site
login = string to search on github source codes,
you can use pcre regex here.
out.txt = objective of this file is populate the result URLs,
that have on "regex" search pattern...
2 = search on two pages
------
Greets:
@usscastro, @spookerlabs, @marcos_alvares, @conviso ...
=cut
# load modules
use LWP;
use URI;
use Term::ANSIColor;
print color 'green';
sub clear() {
my $cmd=0; my $sys="$^O";
if($sys eq "linux") { $cmd="clear"; } else { $cmd="cls"; }
print `$cmd`;
}
sub banner() {
print q{
_ _ _ _ _ _
__ _(_) |_| |__ _ _| |__ | |__ __ _ ___| | __
/ _` | | __| '_ \| | | | '_ \ | '_ \ / _` |/ __| |/ /
| (_| | | |_| | | | |_| | |_) | | | | | (_| | (__| <
\__, |_|\__|_| |_|\__,_|_.__/ |_| |_|\__,_|\___|_|\_\
|___/
---------------------------------------------
Coded By Cooler_
---------------------------------------------
Version 0.02 Beta
contact: acosta[at]conviso[dot]com[dot]br
c00f3r[at]gmail[dot]com
}
}
my @config = (
'User-Agent'=>'Mozilla/4.76 [en] (Win98 ninja jiraia limited edition; U)',
'Accept-Charset'=>'iso-8859-1',
'Accept-Language'=>'en-US',
'max_redirect' => 3,
'Accept-Encoding' => 'gzip',
);
$git_search = $ARGV[0];
$grep = $ARGV[1];
$txt = $ARGV[2];
$pages = $ARGV[3];
print "Searching to:";
print color 'yellow';
print " $git_search\n";
print color 'green';
print "save file:";
print color 'yellow';
print " $txt\n";
print color 'green';
print "Pattern to search: ";
print color 'yellow';
print " $grep\n";
print color 'reset';
if((!$git_search)&&(!$txt)&&(!$grep))
{
print color 'green';
banner();
print "Please follow the example ./programm str_2_search_on_git find_on_source_codes file_log.txt number_of_pages_2_search\n";
print color 'reset';
exit;
}
if(($git_search)&&($txt))
{
banner();
# items to search per page, default is 20
if(!$pages)
{
$pages=20;
}
for($num=0; $num<=$pages; $num++)
{
# request
# "https://github.com/search?l=&p=$num&q=$busca&ref=advsearch&type=Code";
$url=URI->new('https://github.com/search?l=');
$url->query_form('p'=>$num,'q'=>$git_search,'ref'=>'advsearch','type'=>'Code');
$request=LWP::UserAgent->new;
my $response=$request->get($url,@config);
# $res=$response->content;
$res=$response->decoded_content(charset => 'utf8');
@html = split "\n", $res;
$parse=0;
@urls;
# parser on response
foreach(@html)
{
# wait if block...
if($_ =~ m/Whoa there\!/)
{
$parse=0;
print "wait delay";
sleep 2;
break;
}
if($parse eq 1)
{
if($_ =~ m/\/table/)
{
$parse=0;
}
# extract URL
if($_ =~ /<a href="(.*?)" title/ )
{
$tmp=$1;
$link_raw="https://raw.github.com$tmp";
$link_raw =~ s/blob\///;
$link="https://github.com$tmp";
$request=LWP::UserAgent->new;
my $response=$request->get($link_raw,@config);
$res=$response->decoded_content(charset => 'utf8');
# $res=$response->content;
@html_source = split "\n", $res;
$source_parse=0;
print "$link \n";
# grep on source code
foreach(@html_source)
{
if($_ =~ /$grep/)
{
print color 'green';
print "[ found ] : ";
print color 'reset';
print " search string \"$grep\" on $link \n";
# write logs
open my $fh, '>>', "$txt" or die "Cannot open $txt: $!";
print $fh "$link\n";
close $fh;
break;
}
}
push(@urls,$link);
}
}
if($_ =~ m/code-list-item/)
{
$parse=1;
}
}
sleep 2;
}
clear(); banner();
print "---------------\nTotal off links ".scalar @urls."\n fault strings on grep, save in $txt\n";
sleep 1;
print color 'reset';
exit;
}