-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
black.py
2074 lines (1937 loc) · 90.6 KB
/
black.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
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/ysr/bin/python3
# Black-Webbrowser v2.0 (New)
#
# ------------------------Black Webbrowser--------------------------
# | ⬛⬛⬛ |
# | Github: https://github.com/black-software-com |
# | Instagram: https://instagram.com/black_software_company |
# | Telgeram: t.me/blacksoftware3 |
# | Twitter: @blacksoftware3 |
# ------------------------------------------------------------------
#
from os import system as command
from time import sleep
from subprocess import getoutput,SubprocessError
from sys import argv
import sys
from random import shuffle
from platform import system
from webbrowser import open_new_tab
from datetime import datetime
try:
from requests import get
except (Exception,ImportError,):
getoutput("python -m pip install requests")
try:
from speedtest import Speedtest
except (Exception,ImportError,):
getoutput("python -m pip install speedtest-cli")
try:
from colorama import Fore,init
init()
except (Exception,ImportError,):
getoutput("python -m pip install colorama")
try:
from wget import download
except (Exception,ImportError,):
getoutput("python -m pip install wget")
try:
from PyQt5.QtCore import QUrl,pyqtSlot,pyqtSignal,QThread
from PyQt5.QtWidgets import QMainWindow,QLabel,QPushButton,QTextEdit,QLineEdit,QAction,QMenuBar,QStatusBar,QToolBar,QApplication,QMessageBox,QProgressBar,QWidget,QVBoxLayout,QRadioButton,QStyleFactory,QMenu
from PyQt5.QtGui import QIcon,QKeySequence,QFont
from PyQt5 import QtGui, QtCore
except (Exception,ImportError,):
getoutput("python -m pip install pyqt5-tools")
try:
from PyQt5.QtWebEngineWidgets import QWebEngineView, QWebEngineSettings
except (Exception,ImportError,):
getoutput("python -m pip install PyQtWebEngine")
try:
from tkinter import *
from tkinter.ttk import *
from tkinter.scrolledtext import ScrolledText
from tkinter.messagebox import showinfo,showerror,askyesno
except (Exception,ImportError):
getoutput("python -m pip install tk-tools")
try:
from tkhtmlview import HTMLLabel
except (Exception,ImportError,):
getoutput("python -m pip install tkhtmlview")
try:
from ttkbootstrap import Style
except (Exception,ImportError,):
getoutput("python -m pip install ttkbootstrap")
try:
from googlesearch import search
except (Exception,ImportError,):
getoutput("python -m pip install googlesearch-python")
def run_bw_o():
file_checkvi = open("./Core/check_vi","r+").read()
bmess = '''
Black-Webbrowser v2.0
Property:
Search speed
Search graphics High quality
System security
'''
if file_checkvi == 'True' or file_checkvi == 'True\n':
try:
ch = get('https://google.com')
if ch.status_code == 200:
# ap = QApplication(sys.argv)
# app.setApplicationName('Black Webbrowser')
window = Window()
window.vi()
# ap.exec_()
except (ConnectionError,Exception,):
showerror(title='Cannot Running',message='Please, Check Internet!')
print(False)
else:
try:
ch = get('https://google.com')
if ch.status_code == 200:
# ap = QApplication(sys.argv)
# ap.setApplicationName('Black Webbrowser')
window = Window()
# ap.exec_()
except (ConnectionError,Exception,):
showerror(title='Cannot Running',message='Please, Check Internet!')
print(False)
class Window(QMainWindow):
def __init__(self):
super(Window, self).__init__()
self.time_zone = datetime.now()
print(f"\nStart Black-Webbrowser At: {self.time_zone}\n")
self.main()
def main(self):
global searchfile,g1,t,f,h
file_check_sd = open("./Core/check_sd","r").read()
if file_check_sd == '0' or file_check_sd == '0\n' or file_check_sd == '1' or file_check_sd == '1\n' or file_check_sd == '2' or file_check_sd == '2\n':
n = int(file_check_sd)
n+=1
file_check_sd = open("./Core/check_sd","w")
file_check_sd.write(str(n))
file_check_sd.close()
else:
open_new_tab('https://idpay.ir/mrprogrammer2938')
sleep(6)
QApplication.setStyle(QStyleFactory.create('windowsvista'))
# self.browser = QWebEngineView(self)
# self.browser.setUrl(QUrl('https://google.com'))
# self.browser.urlChanged.connect(self.update_AddressBar)
# self.setStyleSheet('background-color: black;')
self.setGeometry(100,60,1800,1000)
self.setWindowIcon(QIcon('./Scr/black.png'))
self.update_banner = ""
# self.setCentralWidget(self.browser)
self.status_bar = QStatusBar(self)
self.setStatusBar(self.status_bar)
self.navigation_bar = QToolBar('Navigation Toolbar')
self.navigation_bar.move(150,30)
self.addToolBar(self.navigation_bar)
back_button = QAction("Back", self)
back_button.setStatusTip('Go to previous page you visited')
# back_button.triggered.connect(self.browser.back)
self.navigation_bar.addAction(back_button)
next_button = QAction("Next", self)
next_button.setStatusTip('Go to next page')
# next_button.triggered.connect(self.browser.forward)
self.navigation_bar.addAction(next_button)
home_button = QAction("Home", self)
home_button.setStatusTip('Go to home page (Google page)')
home_button.triggered.connect(self.go_to_home)
self.navigation_bar.addAction(home_button)
refresh_button = QAction("Refresh", self)
refresh_button.setStatusTip('Refresh this page')
# refresh_button.triggered.connect(self.browser.reload)
self.navigation_bar.addAction(refresh_button)
self.navigation_bar.addAction(home_button)
self.navigation_bar.addSeparator()
self.URLBar = QLineEdit(self)
self.URLBar.returnPressed.connect(self.search)
self.lb = QLabel('Black Webbrowser',self)
self.lb.setGeometry(640,50,500,500)
self.lb.setFont(QFont('Arial',30))
self.lb.setStyleSheet('color: green')
self.word_k = QLineEdit(self)
self.word_k.setGeometry(530,350,700,30)
self.word_k.returnPressed.connect(self.search_key)
g1 = QLabel('<a href="https://github.com/black-software-com" target="_blank"> Github </a>',self)
g1.move(50,950)
g1.setOpenExternalLinks(True)
t = QLabel('<a href="https://github.com/black-software-com" target="_blank"> Tools </a>',self)
t.move(100,950)
t.setOpenExternalLinks(True)
f = QLabel('<a href="https://github.com/black-software-Com/Black-Webbrowser/issues" target="_blank"> Send FeedBack </a>',self)
f.move(140,950)
# f.setOpenExtenralLinks(True)
h = QLabel('<a href="https://black-software-com.github.io/Black-Help/" target="_blank"> Help </a>',self)
h.move(240,950)
# h.setOpenExtenralLinks(True)
self.navigation_bar.addWidget(self.URLBar)
self.addToolBarBreak()
menu = QMenuBar(self)
self.setMenuWidget(menu)
aboutfile = menu.addMenu('About')
searchfile = menu.addMenu('Search')
browserm = menu.addMenu('Browser')
reconm = menu.addMenu('Recon')
shellm = menu.addMenu('Shell')
helpm = menu.addMenu('Help')
black_m = QAction('Black',self)
black_m.setShortcut('F1')
black_m.triggered.connect(self.black)
help_m = QAction('Help',self)
help_m.setShortcut('F2')
help_m.triggered.connect(self.help)
aboutfile.addActions([black_m,help_m])
aboutfile.addSeparator()
exit_m = QAction('Exit',self)
exit_m.setShortcut('Ctrl+F4')
exit_m.triggered.connect(quit)
aboutfile.addAction(exit_m)
fastsearch = QAction('Fast Search',self)
fastsearch.triggered.connect(self.fastsearch)
ipchanger = QAction('Ip Changer',self)
ipchanger.triggered.connect(self.ipchanger)
ipset = QAction('Ip Set',self)
ipset.triggered.connect(self.setip)
searchfile.addActions([fastsearch,ipchanger,ipset])
searchfile.addSeparator()
recon = QAction('Recon',self)
recon.triggered.connect(self.recon)
wget_m = QAction('Wget',self)
wget_m.triggered.connect(self.wget)
req = QAction('Request',self)
req.triggered.connect(self.request)
reconm.addActions([recon,wget_m,req])
history = QAction('history',self)
history.triggered.connect(self.history)
history.setShortcut(QKeySequence('Ctrl+H'))
searchfile.addAction(history)
bookmarks_toolbar = QToolBar('Bookmarks', self)
self.addToolBar(bookmarks_toolbar)
blacksoftware = QAction("Black-Software",self)
blacksoftware.setStatusTip('Go To Black Software')
blacksoftware.triggered.connect(self.black)
bookmarks_toolbar.addAction(blacksoftware)
google = QAction('google',self)
google.triggered.connect(lambda : self.search_2('https://www.google.com'))
bing = QAction('Bing',self)
bing.triggered.connect(lambda : self.search_2('https://www.bing.com'))
duck = QAction('Duck Duck Go',self)
duck.triggered.connect(lambda : self.search_2('https://www.duckduckgo.com'))
yahoo = QAction('Yahoo',self)
yahoo.triggered.connect(lambda: self.search_2('https://en-maktoob.yahoo.com/?p=us&guccounter=1&guce_referrer=aHR0cHM6Ly93d3cuZ29vZ2xlLmNvbS8&guce_referrer_sig=AQAAALUS4UUgOxL2QbS5jSlMecrNJ5R8XR2tT-YW1132GwhfyCLl7cyWI6tfLRzRtdzka_fZHRkUkNKauXLKZet84V5nyPONeX5-0gSXi7IafB4lmCUvvHll8F_P6Q1UY36uldjPDPj6zTaR1Lrh-T7rGcpd39BRDtXurs7jYOXFZCnU'))
zarebin = QAction('Zarebin',self)
zarebin.triggered.connect(lambda: self.search_2('https://zarebin.ir'))
browserm.addActions([google,bing,duck,yahoo,zarebin ])
shella = QAction('shell',self)
shella.triggered.connect(self.shell)
shellm.addAction(shella)
help_mm = QAction('Help',self)
help_mm.triggered.connect(self.help)
helpm.addAction(help_mm)
feedbackm = QAction('Send FeedBack',self)
feedbackm.triggered.connect(self.send_feedback)
helpm.addAction(feedbackm)
helpm.addSeparator()
inst = QAction('Join Us on Instagram',self)
inst.triggered.connect(self.instagram)
helpm.addAction(inst)
helpm.addSeparator()
donate_mm = QAction('donate',self)
donate_mm.setShortcut('Ctrl+D')
donate_mm.triggered.connect(self.donate)
helpm.addAction(donate_mm)
helpm.addSeparator()
about_hm = QAction('About',self)
about_hm.triggered.connect(self.about)
helpm.addAction(about_hm)
facebook = QAction("Facebook", self)
facebook.setStatusTip("Go to Facebook")
facebook.triggered.connect(lambda: self.go_to_URL(QUrl("https://www.facebook.com")))
bookmarks_toolbar.addAction(facebook)
linkedin = QAction("LinkedIn", self)
linkedin.setStatusTip("Go to LinkedIn")
linkedin.triggered.connect(lambda: self.go_to_URL(QUrl("https://in.linkedin.com")))
bookmarks_toolbar.addAction(linkedin)
instagram = QAction("Instagram", self)
instagram.setStatusTip("Go to Instagram")
instagram.triggered.connect(lambda: self.go_to_URL(QUrl("https://www.instagram.com")))
bookmarks_toolbar.addAction(instagram)
twitter = QAction("Twitter", self)
twitter.setStatusTip('Go to Twitter')
twitter.triggered.connect(lambda: self.go_to_URL(QUrl("https://www.twitter.com")))
bookmarks_toolbar.addAction(twitter)
self.show()
def search_key(self):
self.word = self.word_k.text()
url = QUrl(f'https://zarebin.ir/search?q={self.word}')
self.word_k.close()
g1.close()
t.close()
h.close()
f.close()
self.browser = QWebEngineView(self)
self.browser.setUrl(url)
self.browser.urlChanged.connect(self.update_AddressBar)
self.setCentralWidget(self.browser)
self.update_AddressBar(url)
def donate(self):
self.go_to_URL(QUrl('https://idpay.ir/mrprogrammer2938'))
def recon(self):
global user
win = Tk()
win.title('Black-Webbrowser/Recon')
win.geometry("500x400+300+100")
photo = PhotoImage(file='black.png')
win.iconphoto(False,photo)
s = Style("darkly")
ul = Label(win,text='Enter User: ',foreground='white')
ul.place(bordermode=INSIDE,x=50,y=25)
user = Entry(win,borderwidth=3,width=25)
user.place(bordermode=INSIDE,x=145,y=25)
click = Button(win,text='Scan',width=9,height=3,command=self.recon_r)
click.place(bordermode=OUTSIDE,x=210,y=70)
exit = Button(win,text='Exit',width=9,height=3,command=win.destroy)
exit.place(bordermode=OUTSIDE,x=210,y=145)
win.resizable(0,0)
win.bind("<Return>",self.recon_r)
win.mainloop()
def update_blackwebbrowser(self):
self.title_update()
self.cls()
print(self.update_banner)
if system() == 'Linux':
getoutput("cd .. && rm -r Black-Webbrowser && git clone https://github.com/black-software-com/black-webbrowser && cd black-webbrowser && python black")
else:
print("Download Black-Webbrowser.zip")
open_new_tab("https://github.com/black-software-Com/Black-Webbrowser/archive/refs/heads/master.zip")
def recon_r(self,event=None):
global ccmenu,textt,scrollbarr
mylist = []
for i in search(user.get()):
mylist.append(f'{i} \n')
win = Tk()
win.title('Black-Webbrowser/History')
win.geometry("500x400+300+100")
win.resizable(0,0)
menu = Menu(win,tearoff=0)
filemenu = Menu(menu,tearoff=0)
filemenu.add_command(label='Exit',accelerator='Ctrl+F4',command=win.destroy)
menu.add_cascade(label='File',menu=filemenu)
win.configure(menu=menu)
ccmenu = Menu(win,tearoff=0)
ccmenu.add_command(label='Cut',accelerator='Ctrl+X',command=self.cccut)
ccmenu.add_command(label='Copy',accelerator='Ctrl+C',command=self.cccopy)
ccmenu.add_command(label='Paste',accelerator='Ctrl+V',command=self.ccpaste)
ccmenu.add_command(label='Reload',accelerator='Ctrl+R',command=self.ccreload)
ccmenu.add_separator()
ccmenu.add_command(label='Delete',accelerator='Ctrl+D',command=self.ccdelete)
ccmenu.add_separator()
ccmenu.add_command(label='Select All',accelerator='Ctrl+A',command=self.cselectall_text)
ccmenu.add_separator()
ccmenu.add_command(label='Exit',accelerator='Ctrl+F4',command=win.destroy)
s = Style('darkly')
textt = Text(win, height=50,width=60)
textt.grid(row=0, column=0, sticky='ew')
scrollbarr = Scrollbar(win, orient='vertical', command=textt.yview)
scrollbarr.grid(row=0, column=1, sticky='ns')
textt['state'] = 'normal'
textt.insert(END,mylist)
textt['state'] = 'disabled'
win.bind("<Control-a>",self.cselectall_text)
win.bind("<Control-r>",self.creload)
win.bind("<Control-d>",self.cdelete)
win.bind("<Button-3>",self.doo_popup)
win.mainloop()
def cls(self):
if system() == 'Windows':
command("cls")
else:
command("clear")
def title(self):
if system() == 'Linux':
command("printf '\033]2;Black-Webbrowser\a'")
else:
command("title Black-Webbrowser")
def title_update(self):
if system() == 'Linux':
command("printf '\033]2;Black-Webbrowser/Update\a'")
else:
command("title Black-Webbrowser/Update")
def wget(self):
global link,click,exit_b,txt,window,wmenu
window = Tk()
wmenu = Menu(window,tearoff=0)
wfilemenu = Menu(wmenu,tearoff=0)
wfilemenu.add_command(label='Scan',command=self.wget_r)
wfilemenu.add_command(label='Reset',command=self.clear_dw)
wfilemenu.add_separator()
wfilemenu.add_command(label='Exit',accelerator='Ctrl+F4',command=window.destroy)
wrfilemenu = Menu(wmenu,tearoff=0)
wrfilemenu.add_command(label='Scan',command=self.wget_r)
wrfilemenu.add_command(label='Reset',command=self.clear_dw)
wrfilemenu.add_separator()
wrfilemenu.add_command(label='Exit',accelerator='Ctrl+F4',command=window.destroy)
wmenu.add_cascade(label='Options',menu=wfilemenu)
window.config(menu=wmenu)
window.title('Black-Webbrowser/Wget')
window.geometry("750x525+300+100")
s = Style("darkly")
photo = PhotoImage(file='black.png')
window.iconphoto(False,photo)
label = Label(window,text='Enter Link: ',foreground='white')
label.place(bordermode=INSIDE,x=25,y=25)
link = Entry(window,borderwidth=3,width=65)
link.place(bordermode=INSIDE,x=118,y=25)
click = Button(window,text='Scan',width=9,height=1,command=self.wget_r)
click.place(bordermode=OUTSIDE,x=390,y=60)
exit_b = Button(window,text='Exit',width=9,height=1,command=window.destroy)
exit_b.place(bordermode=OUTSIDE,x=295,y=60)
txt = ScrolledText(window)
txt['width'] = 70
txt['height'] = 20
txt.place(bordermode=INSIDE,x=40,y=95)
txt['state'] = 'disabled'
window.bind("<Button-3>",self.do_popupw)
window.resizable(0,0)
window.bind("<Return>",self.wget_r)
window.mainloop()
def do_popupw(self,event):
try:
wmenu.tk_popup(event.x_root,event.y_root)
finally:
wmenu.grab_release()
def wget_r(self,event=None):
d = download(link.get())
txt['state'] = 'normal'
txt.insert(INSERT,d)
txt['state'] = 'disabled'
click.place(bordermode=OUTSIDE,x=350,y=60)
exit_b.place(bordermode=OUTSIDE,x=253,y=60)
clear = Button(window,text='Clear',width=9,height=1,foreground='white',command=self.clear_dw)
clear.place(bordermode=OUTSIDE,x=447,y=60)
def clear_dw(self):
global txt
link.delete(0,END)
txt.destroy()
txt = ScrolledText(window)
txt['width'] = 70
txt['height'] = 20
txt.place(bordermode=INSIDE,x=40,y=95)
def request(self):
global host
win = Tk()
win.title('Black-Webbrowser/Request')
win.geometry("500x400+300+100")
photo = PhotoImage(file='black.png')
win.iconphoto(False,photo)
s = Style("darkly")
hl = Label(win,text='Enter Host: ',foreground='white')
hl.place(bordermode=INSIDE,x=50,y=25)
host = Entry(win,borderwidth=3,width=25)
host.place(bordermode=INSIDE,x=145,y=25)
click = Button(win,text='Scan',width=9,height=3,command=self.request_r)
click.place(bordermode=OUTSIDE,x=210,y=70)
exit = Button(win,text='Exit',width=9,height=3,command=win.destroy)
exit.place(bordermode=OUTSIDE,x=210,y=145)
win.resizable(0,0)
win.bind("<Return>",self.request_r)
win.mainloop()
def request_r(self,event=None):
if host.get()[0:8] == 'https://' or host.get()[0:7] == 'http://':
r = get(host.get())
else:
r = get(f'https://{host.get()}')
showinfo(title='Request',message=f'Ping: {r.status_code}')
def set_ip(self,event=None):
self.ip_i = ip_i.get()
try:
askq = askretrycancel(title='Black-Webbrowser/Ip-Set',message='Do You Want To Set Ip?')
if askq:
getoutput(f"netsh interface ip set address name=”Local Area Connection” static {self.ip_i} 255.255.255.0 {self.ip_i}")
getoutput(f"netsh interface ip set address name=”Local Area Connection” source=dhcp")
getoutput(f"netsh interface ip set dns name=”Local Area Connection” static {self.ip}")
getoutput(f"netsh interface ip add dns name=”Local Area Connection” 8.8.8.8 index=2")
getoutput(f"netsh interface ip set dnsservers name=”Local Area Connection” source=dhcp")
print(f"\nIp Set: {Fore.GREEN}{self.ip_i}{self.end}\n")
searchfile.add_command(label='My-Ip',command=self.my_ip)
win_i.destroy()
else:
print(False)
except (Exception,SubprocessError,) as err:
print(err)
# showerror(title='Error',message='Cannot Running This Program!')
# print(False)
def setip(self):
global win_i,ip_i
win_i = Tk()
s = Style("sandstone")
win_i.title('Black-Webbrowser/Set-Ip')
win_i.geometry("400x300+300+100")
win_i.resizable(0,0)
label = Label(win_i,text='Enter Ip:')
label.place(bordermode=INSIDE,x=45,y=10)
ip_i = Entry(win_i,width=20)
ip_i.place(bordermode=INSIDE,x=120,y=10)
click = Button(win_i,text='Set',width=9,command=self.set_ip)
click.place(bordermode=OUTSIDE,x=165,y=60)
exit_b = Button(win_i,text='Exit',width=9,command=win_i.destroy)
exit_b.place(bordermode=OUTSIDE,x=165,y=120)
win_i.bind("<Return>",self.set_ip)
win_i.mainloop()
def ipchanger(self):
myn1 = []
myn2 = []
myn3 = []
mynall = []
myn1.append(self.my_nums[0:3])
myn2.append(self.my_nums[3:6])
myn3.append(self.my_nums[6:10])
for num in myn1:
mynall.append(num)
for num2 in myn2:
mynall.append(num2)
for num3 in myn3:
mynall.append(num3)
shuffle(mynall)
a = ""
for i in mynall:
for j in i:
a+=str(j)
self.ip = f"{a[0:3]}.{a[3:6]}.{a[6:9]}"
try:
getoutput(f"netsh interface ip set address name=”Local Area Connection” static {self.ip} 255.255.255.0 {self.ip}")
getoutput(f"netsh interface ip set address name=”Local Area Connection” source=dhcp")
getoutput(f"netsh interface ip set dns name=”Local Area Connection” static {self.ip}")
getoutput(f"netsh interface ip add dns name=”Local Area Connection” 8.8.8.8 index=2")
getoutput(f"netsh interface ip set dnsservers name=”Local Area Connection” source=dhcp")
print(f"\nIp Set: {Fore.GREEN}{self.ip}{self.end}\n")
searchfile.add_command(label='My-Ip',command=self.my_ip)
self.after(900000,self.change_ip)
except (Exception,SubprocessError,):
showerror(title='Error',message='Cannot Running This Program!')
print(False)
def fastsearch(self):
sp = Speedtest()
if system() == 'Windows':
try:
command = getoutput("Netsh int tcp show global");print(command)
command2 = getoutput("Netsh int tcp set chimney=enabled");print(command2)
command3 = getoutput("Netsh int tcp set global autotuninglevel=normal");print(command3)
command4 = getoutput("Netsh int set global congestionprovider=ctcp");print(command4)
print(True)
showinfo(title='Internet Speed',message=f'Your Speed: \nDownload: {sp.download()}\nUpload: {sp.upload()}')
except SubprocessError:
print(False)
showerror(title='Error',message='Cannot Running This Program!')
else:
return # Linux
@pyqtSlot()
def history(self):
file_ch = open("./Core/check_hp","r+").read()
if file_ch == 'False' or file_ch == 'False\n':
global text,scrollbar,cmenu
win = Tk()
win.title('Black-Webbrowser/History')
win.geometry("500x400+300+100")
win.resizable(0,0)
photo = PhotoImage(file='black.png')
win.iconphoto(False,photo)
menu = Menu(win,tearoff=0)
filemenu = Menu(menu,tearoff=0)
filemenu.add_command(label='Clear',command=self.clear_history)
filemenu.add_separator()
filemenu.add_command(label='Exit',accelerator='Ctrl+F4',command=win.destroy)
menu.add_cascade(label='File',menu=filemenu)
win.configure(menu=menu)
cmenu = Menu(win,tearoff=0)
cmenu.add_command(label='Cut',accelerator='Ctrl+X',command=self.ccut)
cmenu.add_command(label='Copy',accelerator='Ctrl+C',command=self.ccopy)
cmenu.add_command(label='Paste',accelerator='Ctrl+V',command=self.cpaste)
cmenu.add_command(label='Reload',accelerator='Ctrl+R',command=self.creload)
cmenu.add_separator()
cmenu.add_command(label='Select All',accelerator='Ctrl+A',command=self.selectall_text)
cmenu.add_separator()
cmenu.add_command(label='Delete',accelerator='Ctrl+D',command=self.cdelete)
cmenu.add_command(label='Clear',command=self.clear_history)
cmenu.add_separator()
cmenu.add_command(label='Exit',accelerator='Ctrl+F4',command=win.destroy)
s = Style('darkly')
file_h = open("./Core/history.txt","r+").read()
text = Text(win, height=50,width=60)
text.grid(row=0, column=0, sticky='ew')
scrollbar = Scrollbar(win, orient='vertical', command=text.yview)
scrollbar.grid(row=0, column=1, sticky='ns')
text['state'] = 'normal'
text.insert(END,file_h)
text['state'] = 'disabled'
win.bind("<Control-a>",self.selectall_text)
win.bind("<Control-r>",self.creload)
win.bind("<Control-d>",self.cdelete)
win.bind("<Button-3>",self.do_popup)
file_ch = open("./Core/check_hp","r+")
file_ch.write("True")
file_ch.close()
win.mainloop()
try:
if win.destroy():
file_ch = open("./Core/check_hp","r+")
file_ch.write("False")
file_ch.close()
else:
print(False)
except (Exception,):
file_ch = open("./Core/check_hp","r+")
file_ch.write("False")
file_ch.close()
else:
pass
def about(self):
global amenu
root = Tk()
root.title('Black-Webbrowser/About')
root.geometry("700x600+550+130")
root.resizable(0,0)
txt_a = '''
Black Webbrowser is a search engine.
Property:
Search speed
System security
'''
photo = PhotoImage(file='./Scr/black.png')
root.iconphoto(False,photo)
amenu = Menu(root,tearoff=0)
filemenu = Menu(amenu,tearoff=0)
filemenu.add_command(label='Help',command=self.help)
filemenu.add_separator()
filemenu.add_command(label='Exit',command=root.destroy)
amenu.add_cascade(label='Options',menu=filemenu)
root.config(menu=amenu)
label_i = Label(root,text='Black Webbrowser',foreground='black',font=("None",28))
label_i.place(bordermode=INSIDE,x=130,y=15)
label_t = Label(root,text=txt_a,foreground='black',font=("None",10))
label_t.place(bordermode=INSIDE,x=175,y=65)
b = HTMLLabel(root,html='<a href="https://black-software-com.github.io/Black-Software/" taregt="_blank"> Black </a>')
b.place(bordermode=INSIDE,x=20,y=200)
g = HTMLLabel(root,html='<a href="https://github.com/black-software-com" target="_blank"> Github </a>')
g.place(bordermode=INSIDE,x=20,y=230)
f = HTMLLabel(root,html='<a href="https://www.facebook.com/profile.php?id=100071465381949" target="_blank"> Facebook </a>')
f.place(bordermode=INSIDE,x=20,y=260)
i = HTMLLabel(root,html='<a href="https://instagram.com/black_software_company" target="_blank"> Instagram</a>')
i.place(bordermode=INSIDE,x=20,y=290)
t = HTMLLabel(root,html='<a href="https://twitter.com/blacksoftware3" target="_blank"> Twitter </a>')
t.place(bordermode=INSIDE,x=20,y=320)
tl = HTMLLabel(root,html='<a href="https://t.me/blacksoftware3" target="_blank"> Telegram </a>')
tl.place(bordermode=INSIDE,x=20,y=350)
z = HTMLLabel(root,html='<a href="https://zil.ink/blacksoftware" target="_blank"> ZLink </a>')
z.place(bordermode=INSIDE,x=20,y=380)
fl = Label(root,text='© Black Software')
fl.place(bordermode=INSIDE,x=280,y=530)
root.bind("<Button-3>",self.do_popupa)
root.mainloop()
def do_popupa(self,event):
try:
amenu.tk_popup(event.x_root,event.y_root)
finally:
amenu.grab_release()
def send_feedback(self):
self.go_to_URL(QUrl('https://github.com/black-software-Com/Black-Webbrowser/issues'))
def instagram(self):
self.go_to_URL(QUrl('https://instagram.com/black_software_company'))
def selectall_text(self,event=None):
text.event_generate("<<SelectAll>>")
def cselectall_text(self,event=None):
textt.event_generate("<<SelectAll>>")
def ccut(self):
textt.event_generate("<<Cut>>")
def ccopy(self):
textt.event_generate("<<Copy>>")
def cpaste(self):
textt.event_generate("<<Paste>>")
def creload(self,event=None):
textt.event_generate("<<Reload>>")
def cdelete(self,event=None):
textt.event_generate("<<Delete>>")
def cccut(self):
textt.event_generate("<<Cut>>")
def cccopy(self):
textt.event_generate("<<Copy>>")
def ccpaste(self):
textt.event_generate("<<Paste>>")
def ccreload(self,event=None):
textt.event_generate("<<Reload>>")
def ccdelete(self,event=None):
textt.event_generate("<<Delete>>")
def do_popup(self,event):
try:
cmenu.tk_popup(event.x_root,event.y_root)
finally:
cmenu.grab_release()
def doo_popup(self,event):
try:
ccmenu.tk_popup(event.x_root,event.y_root)
finally:
ccmenu.grab_release()
def clear_history(self):
global text,scrollbar
q = askyesno(title='Clear History',message='Do You Want To Clear History? ')
if q:
file_h = open("./Core/history.txt","w")
file_h.write("")
file_h.close()
file_h = open("./Core/history.txt","r+").read()
text['state'] = 'normal'
text.delete("1.0",END)
text.insert(END,file_h)
text['state'] = 'disabled'
print(True)
else:
print(False)
def shell(self):
shell_command_help = """
Black-Webbrowser Shell Command:
search <Url>
version
help
"""
self.title()
self.cls()
try:
while True:
inp = input("\nBlack-Webbrowser ~# ").split()
if inp == []:
pass
elif inp[0] == 'version' or inp[0].lower() == 'version':
print(version)
elif inp[0] == 'help' or inp[0].lower() == 'help':
print(shell_command_help)
elif inp[0] == 'search':
if len(inp) < 2:
print("search <Url>")
else:
app = QApplication(sys.argv)
url = inp[1]
w = QMainWindow()
w.setWindowTitle(f'Black-Webbrowser/{url}')
w.setWindowIcon(QIcon('./Scr/black.png'))
w.setGeometry(250,100,1500,900)
browser = QWebEngineView(w)
browser.setUrl(QUrl(url))
w.setCentralWidget(browser)
w.show()
app.exec_()
elif inp[0] == 'black'.lower() or inp[0].lower() == 'start':
file_chvi = open("./Core/check_vi","r").read()
if file_chvi == 'True' or file_chvi == 'True\n':
app = QApplication(sys.argv)
window = Window()
window.vi()
app.exec_()
else:
app = QApplication(sys.argv)
window = Window()
app.exec_()
elif inp[0] == 'update' or inp[0].lower() == 'update':
self.update_blackwebbrowser()
elif inp[0] == 'exit' or inp[0].lower() == 'exit' or inp[0] == 'quit' or inp[0].lower() == 'quit':
exit()
else:
y = " ".join(inp)
print(f'\n{y} Not Found!')
except (Exception,):
showerror(title='Cannot Running',message='Cannot Running This Program!')
print(False)
def help(self):
self.go_to_URL(QUrl('https://black-software-com.github.io/Black-Help/'))
def black(self):
self.go_to_URL(QUrl('https://black-software-com.github.io/Black-Software/'))
def go_to_home(self):
self.close()
window = Window()
def search(self):
url = QUrl(self.URLBar.text())
self.browser = QWebEngineView(self)
self.browser.urlChanged.connect(self.update_AddressBar)
self.setCentralWidget(self.browser)
self.update_AddressBar(url)
self.go_to_URL_2(url)
def search_2(self,url):
url = QUrl(url)
self.browser = QWebEngineView(self)
self.browser.urlChanged.connect(self.update_AddressBar)
self.setCentralWidget(self.browser)
self.update_AddressBar(url)
self.go_to_URL_3(url)
def go_to_URL_3(self,url):
self.browser.setUrl(url)
self.update_AddressBar(url)
def go_to_URL(self):
try:
self.word_k.close()
g1.close()
t.close()
h.close()
f.close()
except (Exception,):
pass
if url.url().find(".com") == -1 and url.scheme() == '':
self.browser.setUrl(f'https://zarebin.ir/search?q={url.url()}')
self.update_AddressBar(url)
file_h = open("./Core/history.txt","a")
file_h.write(f'{url.url()}\n')
file_h.close()
elif url.scheme() == '' and url.url().find(".com"):
self.browser.setUrl(QUrl(f'https://{url.url()}'))
self.update_AddressBar(url)
file_h = open("./Core/history.txt","a")
file_h.write(f'{url.url()}\n')
file_h.close()
else:
self.browser.setUrl(QUrl(url.url()))
self.update_AddressBar(url)
file_h = open("./Core/history.txt","a")
file_h.write(f'{url.url()}\n')
file_h.close()
def go_to_URL_2(self, url):
try:
self.word_k.close()
g1.close()
t.close()
h.close()
f.close()
except (Exception,):
pass
if url.url().find(".com") == -1 and url.scheme() == '':
self.browser.setUrl(QUrl(f'https://zarebin.ir/search?q={url.url()}'))
self.update_AddressBar(url)
file_h = open("./Core/history.txt","a")
file_h.write(f'{url.url()}\n')
file_h.close()
elif url.scheme() == '' and url.url().find(".com"):
self.browser.setUrl(QUrl(f'https://{url.url()}'))
self.update_AddressBar(url)
file_h = open("./Core/history.txt","a")
file_h.write(f'{url.url()}\n')
file_h.close()
else:
self.browser.setUrl(QUrl(url.url()))
self.update_AddressBar(url)
file_h = open("./Core/history.txt","a")
file_h.write(f'{url.url()}\n')
file_h.close()
def update_AddressBar(self, url):
self.URLBar.setText(url.toString())
self.URLBar.setCursorPosition(0)
def vi(self):
mess = QMessageBox()
mess.setWindowTitle('Black-Webbrowser/Note')
mess.setWindowIcon(QIcon('black.png'))
mess.setText(bmess)
re = mess.exec_()
file_checkvi = open("./Core/check_vi","w")
file_checkvi.write("False")
file_checkvi.close()
mess.exec_()
class Thread(QThread):
_signal = pyqtSignal(int)
def __init__(self):
super(Thread, self).__init__()
def __del__(self):
self.wait()
def run(self):
for i in range(100):
sleep(0.1)
self._signal.emit(i)
class color():
green = '\033[92m;'
red = '\033[91m'
cyan = '\033[94m'
orange = '\033[33m'
blue = '\033[34m'
endline = '\033[4m'
end = '\033[0m'
class black_webbrowser_installing(Tk):
def __init__(self):
super(black_webbrowser_installing,self).__init__()
global i_menu
self.style = Style("darkly").master
self.title('Black-Webbrowser/Installing')
self.geometry("650x600+500+100")
self.photo = PhotoImage(file = './Scr/black.png')
i_menu = Menu(self,tearoff=0)
filemenu = Menu(i_menu,tearoff=0)
filemenu.add_command(label='About',accelerator='F1',command=self.about)
filemenu.add_command(label='Black',accelerator='F2',command=self.black)
filemenu.add_separator()
filemenu.add_command(label='Help',accelerator='F3',command=self.black_help)
filemenu.add_separator()
filemenu.add_command(label='Exit',accelerator='Ctrl+F4',command=self.destroy)
i_menu.add_cascade(label='Options',menu=filemenu)
self.config(menu=i_menu)
label_l = Label(self,text='Black-Webbrowser',background='gray13',foreground='green',font=("None",30))
label_l.place(bordermode=INSIDE,x=110,y=20)
self.install_b = Button(self,text='Install',width=9,command=self.install)
self.install_b.place(bordermode=OUTSIDE,x=255,y=110)
self.exit_b = Button(self,text='Exit',width=9,command=self.destroy)
self.exit_b.place(bordermode=OUTSIDE,x=255,y=150)
self.iconphoto(False,self.photo)
self.resizable(False,False)
self.config(menu=i_menu)
self.bind("<F1>",self.about)
self.bind("<F2>",self.black)
self.bind("<F3>",self.black_help)
self.bind("<Button-3>",self.do_popupib)
self.mainloop()
def do_popupib(self,event):
try:
i_menu.tk_popup(event.x_root,event.y_root)
finally:
i_menu.grab_release()
def black(self,event=None):
win = Tk()
win.title('Black-Webbrowser/Black')
win.geometry("600x500")
try:
w = tkinterweb.HtmlFrame(win)
w.load_website('https://black-software-com.github.io/Black-Software/')
w.pack(fill='both',expand=True)
except (Exception,):
print(False)
win.destroy()
win.mainloop()
def about(self,event=None):
win = Tk()
win.title('Black-Webbrowser/About')
win.geometry("600x500")
try:
w = tkinterweb.HtmlFrame(win)
w.load_website('https://github.com/black-software-com')
w.pack(fill='both',expand=True)
except (Exception,):
print(False)
win.destroy()
win.mainloop()
def black_help(self,event=None):
win = Tk()
win.title('Black-Webbrowser/Black-Help')
win.geometry("600x500")
try:
w = tkinterweb.HtmlFrame(win)
w.load_website('https://black-software-com.github.io/Black-Help')
w.pack(fill='both',expand=True)
except (Exception,):
print(False)
win.destroy()
win.mainloop()
def install(self):
global pr
pr = Progressbar(self,orient='horizontal',mode='determinate',length=230)
pr.place(bordermode=INSIDE,x=193,y=78)
pr.start(50)
pr.after(5700,self.install_2)
def install_2(self):
global bmess
bmess = '''
Black-Webbrowser v2.0
Property:
Search speed
Search graphics High quality
System security
'''
pr.stop()
if system() == 'Linux':
getoutput("chmod +x black")
getoutput("cp /Core/black /usr/local/bin && cp /Core/black /usr/bin")
getoutput("bash ./Core/install.sh")
file_chi = open("./Core/file_chi","w")
file_chi.write("True")
file_chi.close()
else:
getoutput("copy /Core/black C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs")
file_chi = open("./Core/file_chi","w")
file_chi.write("True")
file_chi.close()
pr.stop()
pr.destroy()
self.install_b.destroy()
self.start_b = Button(self,text='Start',width=9,command=self.run_bw)
self.start_b.place(bordermode=OUTSIDE,x=255,y=110)
self.exit_b.place(bordermode=OUTSIDE,x=255,y=150)
label_mess = Label(self,text='Complete!',foreground='green',background='gray13')
label_mess.place(bordermode=INSIDE,x=258,y=83)
def ext(self):
self.destroy()
self.quit()
quit()
def run_bw(self):
self.destroy()
file_checkvi = open("./Core/check_vi","r+").read()
bmess = '''
Black-Webbrowser v2.0
Property:
Search speed
Search graphics High quality
System security
'''
if file_checkvi == 'True' or file_checkvi == 'True\n':
try:
ch = get('https://google.com')
if ch.status_code == 200:
# app = QApplication(sys.argv)
# app.setApplicationName('Black Webbrowser')
window = Window()
window.vi()
# ap.exec_()
except (ConnectionError,Exception,):
showerror(title='Cannot Running',message='Please, Check Internet!')
print(False)
else:
try: