diff --git a/README.md b/README.md
index d16c0d32..4a6a0a7b 100644
--- a/README.md
+++ b/README.md
@@ -14,7 +14,7 @@
Installation:
```
-pip install hiphp==0.1.7
+pip install hiphp==0.1.9
```
Usage:
@@ -24,13 +24,14 @@ pip install hiphp==0.1.7
#s
from hiphp import hiphp
-p1=hiphp("","")
-print(p1.get_code())//Get HIPHP ID for first use.
-p1.run("")//Run a code or line in your website.
-p1.run_file("")//Run a code or line in your website from a file.
-p1.run_file("","<__VALUE_NAME__>==")//Run a code or line in your website from a file With the entry of variables.
-p1.cli()//open command panel
-p1.upload("")//Upload a file to the server hosting the site.
+p1=hiphp("","",False) #In order to print the result directly.
+#p1=hiphp("","") #In order to make the result as a variable.
+print(p1.get_code()) #Get HIPHP ID for first use.
+p1.run("") #Run a code or line in your website.
+p1.run_file("") #Run a code or line in your website from a file.
+p1.run_file("","<__VALUE_NAME__>==") #Run a code or line in your website from a file With the entry of variables.
+p1.cli() #open command panel
+p1.upload("") #Upload a file to the server hosting the site.
p1.upload("","./")
#e
@@ -43,7 +44,7 @@ p1.upload("","./Changelog:
```
+## 0.1.9
+ - fix bugs.
+
## 0.1.7
- fix bugs.
diff --git a/Scripts/hiphp_ftp/ftp.py b/Scripts/hiphp_ftp/ftp.py
new file mode 100644
index 00000000..4f214705
--- /dev/null
+++ b/Scripts/hiphp_ftp/ftp.py
@@ -0,0 +1,146 @@
+# EXAMPLES :
+#s
+import re
+from hiphp import hiphp
+from tkinter import *
+from tkinter import filedialog
+import os
+from chardet import detect
+
+url="http://localhost/hiphp.php"
+password="123"
+
+p1=hiphp(password,url).run("""
+function iterateDirectory($i){
+ foreach($i as $path){
+ if($path->isDir()){
+ iterateDirectory($path);
+ }else{
+ echo $path.",";
+ }
+ }
+}
+$dir='.';
+$iterator=new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir));
+iterateDirectory($iterator);""")
+
+files_list=p1.split(",")
+del files_list[-1]
+for i in range(len(files_list)):
+ files_list[i]=files_list[i].replace("\\","/")
+
+# get file encoding type
+def get_encoding_type(file):
+ with open(file,'rb') as f:
+ rawdata = f.read()
+ return detect(rawdata)['encoding']
+
+
+def selectmode():
+ if var1.get()==1:
+ mylist['selectmode']="multiple"
+ else:
+ mylist['selectmode']="SINGLE"
+
+def deleteSelected():
+ #selected=[]
+ cname=mylist.curselection()
+ for i in cname[::-1]:
+ op=mylist.get(i)
+ #selected.append(op)
+ mylist.delete(i)
+ del_file='$file_pointer="'+op+'";if(!unlink($file_pointer)){echo("$file_pointer cannot be deleted due to an error");}else{echo("$file_pointer has been deleted");}'
+ p1=hiphp(password,url).run(f"{del_file}")
+ print(p1)
+ unselect_all()
+
+def select_all():
+ mylist.select_set(0,END)
+
+def unselect_all():
+ mylist.selection_clear(0,END)
+
+def openSelected():
+ if var1.get()==0:
+ cname=mylist.curselection()
+ for i in cname[::-1]:
+ op=mylist.get(i)
+ p1=hiphp(password,url).run(f"echo file_get_contents('{op}');")
+ print(p1)
+
+def upSelected():
+ file=filedialog.askopenfile(parent=root,mode='rb',title='Choose a file')
+ if file!=None:
+ file_name=file.name.split("/")
+ file_name=file_name[len(file_name)-1]
+ p1=hiphp(password,url).upload(file.name)
+
+def upSelected_to():
+ if var1.get()==0:
+ cname=mylist.curselection()
+
+ for i in cname[::-1]:
+ op=mylist.get(i)
+ op=op.split("/")
+ path=""
+ for i in range(len(op)-1):
+ if path=="":
+ ss=""
+ else:
+ ss="/"
+ path=path+ss+op[i]
+
+ file=filedialog.askopenfile(parent=root,mode='rb',title='Choose a file')
+ if file!=None:
+ file_name=file.name.split("/")
+ file_name=file_name[len(file_name)-1]
+
+ p1=hiphp(password,url).upload(file.name,path+"/")
+
+root=Tk()
+root.title('Hiphp FTP')
+#root.iconbitmap(r'favicon.ico')
+root.geometry('700x500')
+scrollbar=Scrollbar(root)
+
+mylist=Listbox(root,bd=0,yscrollcommand=scrollbar.set)#,selectmode="multiple"
+
+x=files_list
+for item in range(len(x)):
+ mylist.insert(END,x[item])
+ mylist.itemconfig(item,bg="#f6f6f6")
+
+mylist.pack(side=LEFT,padx=0,pady=0,expand=YES,fill="both")
+scrollbar.pack(side=LEFT,fill=BOTH)
+scrollbar.config(command=mylist.yview)
+
+select_all_btn=Button(root,text="Select all",command=select_all)
+select_all_btn.pack()
+select_all_btn.config(width=15)#,height=2
+
+unselect_all_btn=Button(root,text="Unselect all",command=unselect_all)
+unselect_all_btn.pack()
+unselect_all_btn.config(width=15)
+
+openSelected_btn=Button(root,text="Open",command=openSelected)
+openSelected_btn.pack()
+openSelected_btn.config(width=15)
+
+upSelected_btn=Button(root,text="Upload",command=upSelected)
+upSelected_btn.pack()
+upSelected_btn.config(width=15)
+
+upSelected_to_btn=Button(root,text="Upload to",command=upSelected_to)
+upSelected_to_btn.pack()
+upSelected_to_btn.config(width=15)
+
+deleteSelected_btn=Button(root,text="Delete",command=deleteSelected)
+deleteSelected_btn.pack()
+deleteSelected_btn.config(width=15)
+
+var1=IntVar()
+c1=Checkbutton(root,text='multiple selection',variable=var1,onvalue=1,offvalue=0,command=selectmode)
+c1.pack(side="bottom")
+
+mainloop()
+#e
\ No newline at end of file
diff --git a/changelog.txt b/changelog.txt
index b14cac91..69fea824 100644
--- a/changelog.txt
+++ b/changelog.txt
@@ -1,3 +1,6 @@
+## 0.1.9
+ - fix bugs.
+
## 0.1.7
- fix bugs.
diff --git a/examples.py b/examples.py
index 72780663..4836c5ce 100644
--- a/examples.py
+++ b/examples.py
@@ -2,7 +2,7 @@
#s
from hiphp import hiphp
-p1=hiphp("123","http://localhost/index.php")
+p1=hiphp("123","http://localhost/index.php",False)
# Example:1
# GET ID:
diff --git a/hiphp/__init__.py b/hiphp/__init__.py
index 5063cb8c..df0c3e94 100644
--- a/hiphp/__init__.py
+++ b/hiphp/__init__.py
@@ -7,13 +7,14 @@
#s
from hiphp import hiphp
-p1=hiphp("","")
-print(p1.get_code())//Get HIPHP ID for first use.
-p1.run("")//Run a code or line in your website.
-p1.run_file("")//Run a code or line in your website from a file.
-p1.run_file("","<__VALUE_NAME__>==")//Run a code or line in your website from a file With the entry of variables.
-p1.cli()//open command panel
-p1.upload("")//Upload a file to the server hosting the site.
+p1=hiphp("","",False) #In order to print the result directly.
+#p1=hiphp("","") #In order to make the result as a variable.
+print(p1.get_code()) #Get HIPHP ID for first use.
+p1.run("") #Run a code or line in your website.
+p1.run_file("") #Run a code or line in your website from a file.
+p1.run_file("","<__VALUE_NAME__>==") #Run a code or line in your website from a file With the entry of variables.
+p1.cli() #open command panel
+p1.upload("") #Upload a file to the server hosting the site.
p1.upload("","./")
#e
##################################################################
@@ -21,7 +22,7 @@
#s
from hiphp import hiphp
-p1=hiphp("123","http://localhost/index.php")
+p1=hiphp("123","http://localhost/index.php",False)
# Example:1
# GET ID:
@@ -100,7 +101,7 @@
"""
# VALUES :
#s
-__version__="0.1.7"
+__version__="0.1.9"
__name__="hiphp"
__author__="Yasser BDJ (Ro0t96)"
__author_email__="by.root96@gmail.com"
@@ -127,7 +128,8 @@
limitations under the License.'''
__copyright__='Copyright 2008 -> Present, '+__author__
-__changelog__=("## 0.1.7\n - fix bugs.\n\n")
+__changelog__=("## 0.1.9\n - fix bugs.\n\n")
+__changelog__=__changelog__+("## 0.1.7\n - fix bugs.\n\n")
__changelog__=__changelog__+("## 0.1.6\n - fix bugs.\n - add upload to upload any file.\n - Simplify the use of the program.\n\n")
__changelog__=__changelog__+("## 0.1.5\n - fix bugs.\n\n")
__changelog__=__changelog__+("## 0.1.4\n - fix bugs.\n - new build. \n\n")
@@ -151,22 +153,26 @@
#start hiphp class:
class hiphp:
#__init__:
- def __init__(self,key,url):
+ def __init__(self,key,url,returns=True):
self.key=ashar(key,key).encode()
self.url=url
self.headers={'User-Agent':self.key}
self.print=hexor()
self.print2=hexor(True)
-
+ self.returns=returns
+
#run:
def run(self,command):
- hiphp.do(self.url,self.headers,command)
+ if self.returns==True:
+ return hiphp.do(self.url,self.headers,command,self.returns)
+ else:
+ hiphp.do(self.url,self.headers,command,self.returns)
#cli:
def cli(self):
command=input('hiphp>>>')
if command:
- hiphp.do(self.url,self.headers,command)
+ hiphp.do(self.url,self.headers,command,self.returns)
else:
print(p1.c("Command not found!","#ff5b3c"))
hiphp.cli(self)
@@ -182,8 +188,11 @@ def run_file(self,file,*opts):
for i in range(len(opts)):
value,string=opts[i].split("==")
open_file=open_file.replace(f"__{value}__",string)
-
- hiphp.do(self.url,self.headers,open_file)
+
+ if self.returns==True:
+ return hiphp.do(self.url,self.headers,open_file,self.returns)
+ else:
+ hiphp.do(self.url,self.headers,open_file,self.returns)
except:
self.print.c("The file you entered does not exist.","#ff5b3c")
@@ -198,22 +207,28 @@ def upload(self,path_to_upluad,to=""):
except:
self.print.c(f"We could not read the file {path_to_upluad}","#ff5b3c")
#do:
- def do(url,headers,command):
+ def do(url,headers,command,returns):
response=requests.post(url,headers=headers)
if response.status_code==200:
if response.text[0:7]=="#python":
ploads={'command':command}#open('php.php').read()
response=requests.post(url,headers=headers,data=ploads)
- hiphp.check_errors(response.text[7:])
+ if returns==True:
+ return hiphp.check_errors(response.text[7:],returns)
+ else:
+ hiphp.check_errors(response.text[7:],returns)
else:
hexor().c("We were unable to recognize the hiphp identifier.","#ff5b3c")
else:
hexor().c("We were unable to connect '"+url+"'.","#ff5b3c")
#check_errors:
- def check_errors(response):
+ def check_errors(response,returns):
if response[:6]!="
":
- print(response)
+ if returns==True:
+ return response
+ else:
+ print(response)
else:
result=re.search('on line (.*)
',response)
hexor().c(f"ERROR in line {result.group(1)}.","#ff5b3c")
diff --git a/setup.py b/setup.py
index 57936beb..0350039e 100644
--- a/setup.py
+++ b/setup.py
@@ -1,7 +1,7 @@
from setuptools import setup,find_packages
setup(
name="hiphp",
- version="0.1.7",
+ version="0.1.9",
author="Yasser BDJ (Ro0t96)",
author_email="by.root96@gmail.com",
description='''A package for controlling a php-based website.''',
diff --git a/usage.py b/usage.py
index 112fd2e4..f8c743a3 100644
--- a/usage.py
+++ b/usage.py
@@ -2,12 +2,13 @@
#s
from hiphp import hiphp
-p1=hiphp("","")
-print(p1.get_code())//Get HIPHP ID for first use.
-p1.run("")//Run a code or line in your website.
-p1.run_file("")//Run a code or line in your website from a file.
-p1.run_file("","<__VALUE_NAME__>==")//Run a code or line in your website from a file With the entry of variables.
-p1.cli()//open command panel
-p1.upload("")//Upload a file to the server hosting the site.
+p1=hiphp("","",False) #In order to print the result directly.
+#p1=hiphp("","") #In order to make the result as a variable.
+print(p1.get_code()) #Get HIPHP ID for first use.
+p1.run("") #Run a code or line in your website.
+p1.run_file("") #Run a code or line in your website from a file.
+p1.run_file("","<__VALUE_NAME__>==") #Run a code or line in your website from a file With the entry of variables.
+p1.cli() #open command panel
+p1.upload("") #Upload a file to the server hosting the site.
p1.upload("","./")
#e
diff --git a/version.txt b/version.txt
index a1e1395a..82551adb 100644
--- a/version.txt
+++ b/version.txt
@@ -1 +1 @@
-0.1.7
\ No newline at end of file
+0.1.9
\ No newline at end of file