This repository has been archived by the owner on Jan 26, 2024. It is now read-only.
forked from zvtyrdtx/OSIF
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathosif.py
794 lines (676 loc) · 18.4 KB
/
osif.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
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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
import json , sys , hashlib , os
########################################################################
# COLOR
if sys.platform in ["linux","linux2"]:
W = "\033[0m"
G = '\033[32;1m'
R = '\033[31;1m'
else:
W = ''
G = ''
R = ''
#
########################################################################
try:
import requests
except ImportError:
print R + '_ _'.center(44)
print "o' \.=./ `o".center(44)
print '(o o)'.center(44)
print 'ooO--(_)--Ooo'.center(44)
print W + ' '
print ('O S I F').center(44)
print ' '
print '[!] Error'
print "[!] Can't import module 'requests'\n"
sys.exit()
######################################################################
reload (sys)
sys . setdefaultencoding ( 'utf8' )
jml = []
jmlgetdata = []
n = []
def baliho():
try:
token = open('token.txt','r').read()
r = requests.get('https://graph.facebook.com/me?access_token=' + token)
a = json.loads(r.text)
name = a['name']
n.append(a['name'])
print R + '_ _'.center(44)
print "o' \.=./ `o".center(44)
print '(o o)'.center(44)
print 'ooO--(_)--Ooo'.center(44)
print ' ' + W
print ('[*] ' + name + ' [*]').center(44)
print ' '
except IOError:
print R + '_ _'.center(44)
print "o' \.=./ `o".center(44)
print '(o o)'.center(44)
print 'ooO--(_)--Ooo'.center(44)
print ' ' + W
print ('O S I F').center(44)
print (W + ' [' + G +'Open Source Information Facebook'+ W + ']')
print ' '
def show_program():
print G + '''
INFORMATION''' + W + """
------------------------------------------------------
Author Debby Anggraini 'CiKu370'
Name OSIF 'Open Source Information Facebook'
CodeName D3b2y
version 4.0
Date 16/05/2018 09:35:12
Team Blackhole Security
Email [email protected]
Telegram @CiKu370
* if you find any errors or problems , please contact
author
"""
def info_ga():
print G + '''
COMMAND DESCRIPTION''' + W + """
------------- -------------------------------------
get_data collect all friend data
get_info show information about your friend
dump_id get all friends facebook id
dump_phone get all friends phone numbers
dump_mail get all friend emails
token Generate access token Fb
cat_token show your access token Fb
rm_token remove token.txt
bot open bot menu
clear clear terminal
help show help
about Show information about this program
exit Exit the program
"""
def menu_bot():
print G + '''
Number INFO ''' + W + """
--------- ------------------------------------
[ 1 ] Like All Post
[ 2 ] React all post with emoji 'Love'
[ 3 ] React all post with emoji 'Wow'
[ 4 ] React all post with emoji 'Haha'
[ 5 ] React all post with emoji 'Sad'
[ 6 ] React all post with emoji "Angry'
[ 7 ] Comment all post
[ 0 ] Back to main menu
"""
##############################################################################
# GENERATE ACCESS TOKEN
def get(data):
print '[*] Generate access token '
b = open('token.txt','w')
try:
r = requests.get('https://api.facebook.com/restserver.php',params=data)
a = json.loads(r.text)
b.write(a['access_token'])
b.close()
print '[*] Success creates an access token'
print '[*] your access token stored in token.txt'
main()
except KeyError:
print '[!] Failed to generate access token'
print '[!] Check your connection / email or password'
main()
def id():
print '[*] log into your facebook account ';id = raw_input('[?] Username : ');pwd = raw_input('[?] Password : ');API_SECRET = '62f8ce9f74b12f84c123cc23437a4a32';data = {"api_key":"882a8490361da98702bf97a021ddc14d","credentials_type":"password","email":id,"format":"JSON", "generate_machine_id":"1","generate_session_cookies":"1","locale":"en_US","method":"auth.login","password":pwd,"return_ssl_resources":"0","v":"1.0"};sig = 'api_key=882a8490361da98702bf97a021ddc14dcredentials_type=passwordemail='+id+'format=JSONgenerate_machine_id=1generate_session_cookies=1locale=en_USmethod=auth.loginpassword='+pwd+'return_ssl_resources=0v=1.0'+API_SECRET
x = hashlib.new('md5')
x.update(sig)
data.update({'sig':x.hexdigest()})
get(data)
#
#################################################################################
#################################################################################
# Bot Like And Comment
# Execute #
def post():
global token , WT
print '[*] Collecting Posts Id'
try:
if WT == 'wallpost':
r = requests.get('https://graph.facebook.com/me/home?fields=id&limit=150&access_token=' + token)
result = json.loads(r.text)
print '[*] Posts id successfully collected'
print '[*] Start'
return result['data']
else:
r = requests.get("https://graph.facebook.com/%s/feed?limit=150&access_token=%s"%(id,token))
result = json.loads(r.text)
print '[*] Posts id successfully collected'
print '[*] Start'
return result['data']
except:
print '[!] Failed To Collecting Posts Id'
bot()
def like(posts , amount):
global type , token , WT
try:
counter = 0
for post in posts:
if counter >= amount:
break
else:
counter = counter + 1
parameters = {'access_token' : token , 'type' : type}
url = "https://graph.facebook.com/{0}/reactions".format(post['id'])
s = requests.post(url, data = parameters)
id = post['id'].split('_')[0]
print W + '[' + G + id + W + '] successfully liked'
print '[*] Done'
bot()
except KeyboardInterrupt:
print '\n[!] CTRL + C detected'
print '[*] Stopped'
bot()
except:
bot()
def cmnt(posts , amount):
global message , token
try:
counter = 0
for post in posts:
if counter >= amount:
break
else:
counter = counter + 1
parameters = {'access_token' : token, 'message' : message}
url = "https://graph.facebook.com/{0}/comments".format(post['id'])
s = requests.post(url, data = parameters)
id = post['id'].split('_')[0]
print W + '[' + G + id + W + '] successfully commented'
print '[*] Done'
bot()
except KeyboardInterrupt:
print '\n[!] CTRL + C detected'
print '[*] Stopped'
except:
bot()
def comment():
global id , WT , token
print '[*] load access token '
try:
token = open('token.txt','r').read()
print '[*] Success load access token'
except IOError:
print '[!] Failed load access token'
print "[!] type 'token' to generate access token"
bot()
WT = raw_input(W + '[?] [' + R + 'W' + W + ']allpost or [' + R + 'T' + W + ']arget (' + R + 'W' + W + '/' + R + 'T' + W + ') : ')
if WT.upper() == 'T':
id = raw_input('[?] id facebook : ')
if id == '':
print "[!] id target can't be empty"
bot()
else:
WT = 'wallpost'
like(post(),150)
def bot():
global type , message , id , WT , token
cek = raw_input(R + 'D3b2y' + W +'/' + R +'Bot ' + W + '>> ')
if cek == '1':
type = "LIKE"
comment()
elif cek == "2":
type = "LOVE"
comment()
elif cek == "3":
type = "WOW"
comment()
elif cek == "4":
type = 'HAHA'
comment()
elif cek == '5':
type = 'SAD'
comment()
elif cek == '6':
type = 'ANGRY'
comment()
elif cek == '7':
print '[*] load access token '
try:
token = open('token.txt','r').read()
print '[*] Success load access token'
except IOError:
print '[!] Failed load access token'
print "[!] type 'token' to generate access token"
bot()
WT = raw_input(W + '[?] [' + R + 'W' + W + ']allpost or [' + R + 'T' + W + ']arget (' + R + 'W' + W + '/' + R + 'T' + W + ') : ')
if WT.lower() == "w":
WT = 'wallpost'
else:
id = raw_input('[?] Id Target : ')
if id == '':
print "[!] id target can't be empty"
bot()
print '--------------------------------------------------'
print " [Note] Use the '</>' symbol to change the line\n"
message = raw_input('[?] Your Message : ')
if message == '':
message = '#bot\n\nhttps://github.com/ciku370'
else:
message = message.replace('</>','\n')
cmnt(post(),150)
elif cek == '0':
print '[*] Back to main menu'
main()
elif cek.lower() == 'menu':
menu_bot()
bot()
else:
if cek == '':
bot()
else:
print "[!] command '"+cek+"' not found"
print '[!] type "menu" to show menu bot'
bot()
#
###############################################################################
###############################################################################
# Dump Data
def dump_id():
print '[*] Load Access Token'
try:
token = open("token.txt",'r').read()
print '[*] success load access token'
except IOError:
print '[!] failed load access token'
print "[*] type 'token' to generate access token"
main()
try:
os.mkdir('output')
except OSError:
pass
print '[*] collecting all friend id'
try:
r = requests.get('https://graph.facebook.com/me/friends?access_token='+token)
a = json.loads(r.text)
out = open('output/' + n[0].split(' ')[0] + '_id.txt','w')
for i in a['data']:
out.write(i['id'] + '\n')
out.close()
print '[*] successfully collect all the friends id'
print '[*] file saved : output/' + n[0].split(' ')[0] + '_id.txt'
main()
except KeyboardInterrupt:
print '[!] CTRL + C detected'
print '[!] Stopped'
main()
except KeyError:
print '[!] failed to collect friend id'
main()
def dump_phone():
print '[*] load access token'
try:
token = open('token.txt','r').read()
print '[*] Success load access token'
except IOError:
print '[!] failed load access token'
print "[*] type 'token' to generate access token"
main()
try:
os.mkdir('output')
except OSError:
pass
print "[*] collect all friend's phone numbers"
print '[*] start'
print ' '
try:
r = requests.get('https://graph.facebook.com/me/friends?access_token='+token)
a = json.loads(r.text)
out = open('output/' + n[0].split(' ')[0] + '_phone.txt','w')
for i in a['data']:
x = requests.get("https://graph.facebook.com/"+i['id']+"?access_token="+token)
z = json.loads(x.text)
try:
out.write(z['mobile_phone'] + '\n')
print ' ~ ' + z['name'] + G + ' >> ' + W + z['mobile_phone']
except:
pass
out.close()
print ' '
print '[*] done'
print "[*] successfully collect friend's phone number"
print '[*] file saved : output/'+n[0].split(' ')[0] + '_phone.txt'
main()
except KeyboardInterrupt:
print '[!] CTRL + C detected'
print '[!] Stopped'
main()
except KeyError:
print "[!] failed to collect all phone numbers of friends"
main()
def dump_mail():
print '[*] load access token'
try:
token = open('token.txt','r').read()
print '[*] Success load access token'
except IOError:
print '[!] failed load access token'
print "[*] type 'token' to generate access token"
main()
try:
os.mkdir('output')
except OSError:
pass
print '[*] collect all friend emails'
print '[*] start'
print ' '
try:
r = requests.get('https://graph.facebook.com/me/friends?access_token='+token)
a = json.loads(r.text)
out = open('output/' + n[0].split(' ')[0] + '_mails.txt','w')
for i in a['data']:
x = requests.get("https://graph.facebook.com/"+i['id']+"?access_token="+token)
z = json.loads(x.text)
try:
out.write(z['email'] + '\n')
print ' ~ ' + z['name'] + G + ' >> ' + W + z['email']
except:
pass
out.close()
print ' '
print '[*] done'
print "[*] successfully collecting all friend emails"
print '[*] file saved : output/'+n[0].split(' ')[0] + '_mails.txt'
main()
except KeyboardInterrupt:
print '[!] CTRL + C detected'
print '[!] Stopped'
main()
except KeyError:
print "[!] failed to collect all emails of friends"
main()
#
###############################################################################
###############################################################################
# Main
def main():
cek = raw_input(R + 'D3b2y' + W +' >> ')
if cek.lower() == 'get_data':
getdata()
elif cek.lower() == 'get_info':
print '\n'+'[*] Information Gathering [*]'.center(44) + '\n'
search()
elif cek.lower() == 'bot':
menu_bot()
bot()
elif cek.lower() == "cat_token":
try:
o = open('token.txt','r').read()
print '[*] Your access token !!\n\n' + o + '\n'
main()
except IOError:
print '[!] failed to open token.txt'
print "[!] type 'token' to generate access token"
main()
elif cek.lower() == 'clear':
if sys.platform == 'win32':
os.system('cls')
baliho()
main()
else:
os.system('clear')
baliho()
main()
elif cek.lower() == 'token':
print '\n' + '[*] Generate Access token facebook [*]'.center(44) + '\n'
print '[Warn] please turn off your VPN before using this feature !!!'
id()
elif cek.lower() == 'rm_token':
print '''
[Warn] you must create access token again if
your token.txt is deleted
'''
a = raw_input("[!] type 'delete' to continue : ")
if a.lower() == 'delete':
try:
os.system('rm -rf token.txt')
print '[*] Success delete token.txt'
main()
except OSError:
print '[*] failed to delete token.txt'
main()
else:
print '[*] failed to delete token.txt'
main()
elif cek.lower() == 'about':
show_program()
main()
elif cek.lower() == 'exit':
print "[!] Exiting Program"
sys.exit()
elif cek.lower() == 'help':
info_ga()
main()
elif cek.lower() == 'dump_id':
dump_id()
elif cek.lower() == 'dump_phone':
dump_phone()
elif cek.lower() == 'dump_mail':
dump_mail()
elif cek.lower() == 'report':
print '[!] Coming soon'
main()
else:
if cek == '':
main()
else:
print "[!] command '"+cek+"' not found"
print '[!] type "help" to show command'
main()
################################################################################
# Get Data
def getdata():
global a , token
if len(jmlgetdata) == 0:
pass
else:
print "[!] You have collected previous friends data"
main()
print '[*] Load Access Token'
try:
token = open("token.txt","r").read()
print '[*] Success load access token'
except IOError:
print '[!] failed to open token.txt'
print "[!] type 'token' to generate access token"
main()
print '[*] collecting friend data..'
try:
r = requests.get('https://graph.facebook.com/me/friends?access_token='+token)
a = json.loads(r.text)
except KeyError:
print '[!] Your access token is expired'
print "[!] type 'token' to generate access token"
main()
for i in a['data']:
jml.append(i['id'])
print '[*] '+str(len(jml))+' data of friends successfully collected'
main()
def search():
if len(jml) == 0:
print "[!] no friend data in the database"
print '[!] please type "get_data" to collect friends data'
main()
else:
pass
target = raw_input("[!] Search Name or Id : ")
if target == '':
print "[!] name or id can't be empty"
search()
elif target.lower() in ['putriy.kaeysha','d3b2y','bintari.s.rini','bintari.styo','bintari.setyo.9']:
print '[!] ' + target + ' is not allowed to be searched'
search()
else:
info(target)
def info(target):
global a , token
print '[*] Searching '
try:
for i in a['data']:
if target in i['name'] or target in i['id']:
x = requests.get("https://graph.facebook.com/"+i['id']+"?access_token="+token)
y = json.loads(x.text)
print ' '
print G + '[-------- INFORMATION --------]'.center(44)
print W
try:
print '\n[*] Id : '+i['id']
except:
pass
try:
print '[*] Username : '+y['username']
except:
pass
try:
print '[*] Email : '+y['email']
except:
pass
try:
print '[*] Mobile Phone : '+y['mobile_phone']
except:
pass
try:
print '[*] Name : '+y['name']
except:
pass
try:
print '[*] First name : '+y['first_name']
except:
pass
try:
print '[*] Midle name : '+y['middle_name']
except:
pass
try:
print '[*] Last name : '+y['last_name']
except:
pass
try:
print '[*] Locale : '+y['locale'].split('_')[0]
except:
pass
try:
print '[*] location : '+y['location']['name']
except:
pass
try:
print '[*] hometown : '+y['hometown']['name']
except:
pass
try:
print '[*] gender : '+y['gender']
except:
pass
try:
print '[*] religion : '+y['religion']
except:
pass
try:
print '[*] relationship status : '+y['relationship_status']
except:
pass
try:
print '[*] political : '+y['political']
except:
pass
try:
print '[*] Work :'
for i in y['work']:
try:
print ' [-] position : '+i['position']['name']
except:
pass
try:
print ' [-] employer : '+i['employer']['name']
except:
pass
try:
if i['start_date'] == "0000-00":
print ' [-] start date : ---'
else:
print ' [-] start date : '+i['start_date']
except:
pass
try:
if i['end_date'] == "0000-00":
print ' [-] end date : ---'
else:
print ' [-] end date : '+i['end_date']
except:
pass
try:
print ' [-] location : '+i['location']['name']
except:
pass
print ' '
except:
pass
try:
print '[*] Updated time : '+y['updated_time'][:10]+' '+y['updated_time'][11:19]
except:
pass
try:
print '[*] Languages : '
for i in y['languages']:
try:
print ' ~ '+i['name']
except:
pass
except:
pass
try:
print '[*] Bio : '+y['bio']
except:
pass
try:
print '[*] quotes : '+y['quotes']
except:
pass
try:
print '[*] birthday : '+y['birthday'].replace('/','-')
except:
pass
try:
print '[*] link : '+y['link']
except:
pass
try:
print '[*] Favourite teams : '
for i in y['favorite_teams']:
try:
print ' ~ '+i['name']
except:
pass
except:
pass
try:
print '[*] School : '
for i in y['education']:
try:
print ' ~ '+i['school']['name']
except:
pass
except:
pass
else:
pass
else:
print W + ' '
print '[*] Done '
main()
except:
main()
#
##########################################################################
##########################################################################
#
if __name__ == '__main__':
baliho()
main()
#
##########################################################################