How to run and manage different versions of Python with virtual environment support by using pyenv

In this post,I am sharing how we can run different versions of python easily with virtual environment support  by usng pyenv .I am using pyenv these days.I find it better than using virtualenv .My currently activated environment remains activated even after restarting Terminal shell which I prefer.Another feature of pyenv  is that you can set environment local to any folder.

Thanks : Yamashita  (Author of pyenv )

Steps :

1.Use pyenv-installer   to install pyenv.You can install pyenv by using this command on Terminal :

$ curl -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash

 

2.To update  pyenv ,use this command :

$ pyenv update

Screenshot from 2017-07-29 11-25-48.png

 

3.Open your .bashrc  file and make sure that these lines are added to it .Otherwise,you need to add these lines  to your .bashrc  file  by editing the file wih sudo command:

# Load pyenv automatically by adding
# the following to ~/.bash_profile:

export PATH=”/home/gaurav/.pyenv/bin:$PATH”
eval “$(pyenv init -)”
eval “$(pyenv virtualenv-init -)”

 

4. To install specific version of Python ,say Python 3.6.1 ,use this command :

$ pyenv install 3.6.1

 

5.To create a virtual environment system ,say  test which uses Python  3.6.1 which we installed in previous step,you can use this command :

$ pyenv virtualenv 3.6.1 test

 

6.To activate this new virtual environment test ,you need to use this command :

$ pyenv virtualenv 3.6.1 test

 

7.To list all virtual environments of pyenv ,use this command :

$ pyenv versions

 

7.To switch back to system Python ,use this command :

$ pyenv global system

 

Screenshot from 2017-07-29 11-29-28.png

 

8.To uninstall any virtual environment ,say test ,use this command and Entere when it asks for confirmation :

$ pyenv uninstall test

 

Now,you can easily run different versions of Python along with virtual environment support.

Thanks  for reading my post.I hope this post will be useful for them who  want to manage different versions of python with virtual environment support .If you have any query/question,please post in comments section.

 

 

 

Advertisements

How to decompile compiled .pyc python files to find/see original source code

Hello,everyone.In this post,i am sharing how to decompile compiled python files which are in .pyc formats usually.It may be useful for reverse enginering and if you want to know the original source code of any compiled python files.It may be also useful whenever  your original .py  python file is deleted unknowingly and there is only compiled .pyc file left  on disk and you want your original .py file back.In all those cases, this method can be used.

I have used Ubuntu OS here and it can be used on Windows OS also.

Tools Required :

uncompyle6  : https://github.com/rocky/python-uncompyle6/

Thanks :R. Bernstein (Author of uncompyle6)

Steps :

1.Install uncompyle6 by using pip on Terminal or you can download from above link and install it by running its setup.py file.To install uncompyle6 by using pip,use this command on Terminal :

pip install uncompyle6

 

2.After installation of  uncompyle6 ,you can check its successfull installation and its usage by running uncompyle6 command on Terminal (see screenshot).

 

3.To decompile any file in current diectory ,use command (see screenshot for example): uncompyle6 -o . <file-name.pc> 

Example : uncompyl6 -o . txfile.pyc rxfile.pyc

Screenshot from 2017-07-01 13-38-05

 

4.You will see your decompiled files created with same name in the current working directory(or desired directory) .Now,you can open this decompiled file with any Text Editor and see original source code.

Screenshot from 2017-07-01 13-38-46.png

 

5.if you want to see decompiled code on terminal(standard output),use command(see screenshot for example ): uncompyle6 <filename.pyc>

Screenshot from 2017-07-01 13-39-59.png

 

Thanks for reading my post.I hope this will be useful for python users who want to decompile compiled python files.

 

 

 

 

Using Python3 and Python2 on Windows OS with pip support

Hello everyone.Today,I am going to share how to use Python3 and Python2 with pip support  on Windows OS.If you try to install latest Python version 3.6 ,it provides you the option of adding Python 3.6 to PATH ,but this is not provided by Python2 installer still.Many users may find it difficult to use both version with corresponding pip on Windows OS.

So,I am sharing this method which helped me to use Python2 and Python3 simultaneously.

STEPS :

1.Download Python3 and Python2 installer from python.org .

2.Run Python3 installer and tick(enable) “Add Python 3.6 to Path” as shown in screenshot so that you can run Python3 by python command on Terminal/Shell.

p3s

 

3.You can run Python3 by using python command and its pip by using pip command.

4.Run Python2 installer and install Python2 .

5.Now ,you need to edit system environment  variable PATH as shown in screenshot below  for using Python2  and its pip2 in Terminal/shell :

path_setup

 

6.Click on Edit Button .After that all the enteries of  PATH  variable will be displayed.Now,click on New Button and add this entry as shown in screenshot:

C:\Python27\Scripts

path_edit.JPG

 

7.Click on OK button to save and make it sure that the entry added to PATH varaiable is not C:\Python27  . Otherwise , python command will run Python2 instead of Python3 .

8. Again add a new entery PY_PATH to system variables and set its value to 2 if you want to run python2 by using py command.

9.Now, you can use Python 3 by using python or py -3 . You can use pip for python 3 by pip or pip3 command .You can use Python2 by using py command or py-2 command .You can use pip for Python2 by using pip2 command.(See Screenshot)

pipnnn.JPG

 

If every step is followed correctly,you will see Python3 and Python2 running successfully with pip support in Terminal.

If you have any query or you need help,post in comments.I will be glad to help you.

Thanks for reading my post.I hope my post will be useful to Python users who are using Windows OS.

 

 

 

Bitly v1.00.0 pys60 app for Symbian S60 by gauravssnl based on bitly_python API

Bitly v1.00.0 pys60 app by gauravssnl based on bitly python API

Geneate bit.ly short URL of any long URL easily and exapand bit.ly URL to get original link.

Bit.ly URLs are used for sharing links on social networking sites and on blogs to make long URLs shorter.

Download link : Bitly app v1.00.0 by gauravssnl.zip

Screenshot :

ss

 

Features :

-Generate bit.ly link

-Expand bit.ly link

Steps :

1. Register an account on bitly.com by visiting this link : https://bitly.com/a/sign_up

2.After that ,you need to get your bitly Access Token of your account

3.Now open Bitly app , and enter your Access Token in Settings from menu.

4.Now,click on Connect .If your Access Token is correct, you will be successfully logged in and your users details will be displayed. If this does not occur, check your Access Token and try again.

5.Now,you can generate bit.ly short URLs and expand bit.ly URLS to get original links

Thanks : Jehiah Czebotar (bitly_ api author)

Thanks everyone.

Py Pastebin v1.00.2 PyS60 App for Symbian S60 by gauravssnl

Py Pastebin v1.00.02 pys60 2.0 app by gauravssnl for Symbian S60 OS

DownloadPy Pastebin v1.00.2 by gauravssnl.zip

This app is for creating new pastes directly from files on pastebin.com

There is no need to open pastebin website and copy & paste your codes.
Pastebin is very famous code sharing website.
I hope this app will be useful for symbian s60 users.

Screenshots :


How to use :
1.You must have an account on pastebin.com
If you do not have an account,you can create a new account .
2.Log /Sign into your account
3.Get your own unique API key by visiting this URL :
pastebin.com/api

4.Now open app Py Pastebin and click on Login Settings.Fill your API Key,username ,passwords.

15241737_1308228179233198_3312973459983355607_n

5.Click on ‘Login’ and wait for successful login.If you are not able to login after several tries ,that means your API key is invalid.Verify your API key.
6.After successful login,you can select a file for creating paste.If paste is succesffully created,that paste URL will be shown.

Thanks everyone.

How to use Python v2 and v3 in Termux app on Android : Simple way to use Python without need of rooting

Today,I am gonna share how to use Python in Termux app on Android phone without need of rooting . It’s very simple and easy way to use Python. Thanks to the developer of Termux , Fredrik Fornwall.

Python v3 installation : 

1.Open Termux app and type this command:

apt install python 

screenshot_20161231-081311

 

2.Now type y if you want to proceed.Otherwise n .

 

3.After successful installation, you can use Python by using this command:

python 

screenshot_20161231-082914

 

 

 

Python v2 installation :

1.Use this command to install python2 :

apt install python2

screenshot_20161231-082740

2.To run python2, use this command: python2

I hope this post will be useful to them who want to use Python v3 and v2 without need of rooting Android phone.

Thanks : Minakshi

Thanks to my family.

How to use Python For Android in Terminal on all Android OS easily by using updated python.sh script

Hello,everyone.In this post,I am going to share how to use Python For Android in Terminal in the easiest way .This method will work on all Android OS versions .This method has been tested on all OS by me and works successfully.By using this method,you can also run  Python with your desired command name  .Let us proceed to the tutorial.

Tools Required: 

1. Python For Android.apk :  Download Here

2. python.sh file (fixed and updated) :  Download Here

3.Terminal.apk : Download Here

Working Screenshot:screenshot_2016-09-05-11-15-01.png

 

Steps:

1.Download & Install Python For Android app.Open it and install it’s Python library by clicking on “Install ” Button.Internet is required for first time installation.After successful installation of Python library,your screen will be as shown in screenshot below:screenshot_2016-09-03-19-28-48.png

2.Now,copy downloaded python.sh script file to /system/bin folder.Now,change the permission of Python.sh file to 777 in /system/bin folder.

3.Now ,open Terminal and you can easily run Python with the command as shown in Screenshot:

python.sh

screenshot_2016-09-05-11-15-01.png

4.If everything is correct,you will see Python running successfully in Terminal.

5.You can also rename the python.sh file in /system/bin to any name you like & then you can use that name as command for running Python.I have renamed python.sh file to gaurav

screenshot_2016-09-05-11-16-58.png

6.Now,i can run Python in Terminal by using command:

gaurav

screenshot_2016-09-05-11-18-00.png

 

7.In that way,you can run Python with your desired command name.

Thanks: Luiz

Happy Phreaking brothers.

Thanks everyone for reading my post.Thanks to my  friends and family.

Post your questions in Comments.

Using Python in Terminal on Android OS  without Root Access

Hello,everyone.Today,I am going to share how to use Python in Terminal on Android phone without Root Access.This post is made for them who do not use Rooted phone or those who do not want to Root.

I had thought that it would not be possible to use Python in Terminal without Root Access.Python scripts can also be run using Sl4A , but I find using Python in Terminal better as Sl4a has no option of changing directory.Running Python files is easier in Terminal.So,let us proceed to the tutorial.

Tools Required: 

1. Python For Android.apk: Download Here

2.Terminal.apk :  Download Here

3. Python.sh: Download Here

4. Sl4A.apk(optional file): Download Here 
Steps: 

1.Download all of the above files if you do not have.Install Python For Android app. You can also install Sl4A app if you want.

2.Open Python For Android app and click on Install button to install Python library on your phone .Internet is required for first time installation.After successful installation of Python library,your screen should be like as shown in screenshot given below:

3.Now,copy Python.sh file to your internal memory sdcard  as shown in the screenshot.

3.Now,open Terminal app.To run Python,type these carefully as shown in screenshot:

sh  /sdcard/python.sh 

4.If everything is fine,you will see Python successfully running on Terminal.If,you get error as Python.sh file not found,make sure that python.sh is there in internal sdcard(/sdcard ).

5.To run a script file say hello.py of folder scripts in your sdcard(/sdcard/scripts folder) as shown in screenshot:

we need to type the following command carefully to run hello.py file( /sdcard/scripts/hello.py ) as shown in screenshot below :

cd /sdcard/scripts

sh  /sdcard/python.sh   hello.py

6. In this way you can run any Python file present in current directory on Terminal app by using the following command:

sh  /sdcard/Python.sh  filename.py

Now,you can use Python and Python Scripts on all  Android OS without Root Access in the way shown above.Tutorial is complete now.

I hope this tutorial will be useful for many users.Thanks everyone for reading my post.

If you have any questions or you get any error,please contact me by posting your comments.

Share this if you really like it.

©gauravssnl

SInjector v2.3 Python Script with Payload support and how to use it with SSH Tunnel for Free Internet

Hello everyone.Now,I would like to share SInjector Python Script which supports SSH and VPN  with Payload feature(like HTTP Injector,eProxy,KPN Tunnel). SInjector Python Script can be used for free internet tricks with SSH or VPN Tunneling.Free Internet with Online privacy.I would like to thank it’s developer RedFox who developed this script.Many have been searching Python script which works similar to apps like  HTTP Injector ,eProxy ,KPN Tunnel  the search finally ends with SInjector .

I will share how to configure/set SInjector Python Script to use SSH & for free internet.

Developer: Red Fox

Tools Required: 

1. SInjector_v2.3.zip  SInjector _v2.3.zip

2.Terminal application : Terminal.apk

Note: Python should be already installed.To know about that,see my other posts.

Script Screenshot:

Steps:

1.Download SInjector v2.3.zip file and extract to si folder of internal sdcard (/sdcard/si).

2.Open payload.ini file and set Payload which works for free internet on your simcard as shown in screenshot and Save the file.Use your imagination to fill working payload.For my simcard , payload working for free internet is shown here in screenshot.(My simcard has free homepage which I can open at 0 balance and I use that in payload bug.You use your free homepage in payload and use your simcard Proxy in this file)

3.You should have a SSH account that we will use with SSH Tunnel application.To know how to do this, see my another post: Using SSH Tunnel on Android Phones to Hide your real IP details and to Access Blocked Websites

I created SSH account on fastssh.com as shown in screenshot.

4.Now,open SSH Tunnel application and fill your user details and SSH account Host correctly as shown in screenshot.You can tick/enable “SOCKS Proxy” if you want to use it for forwarding Request from all ports.If your phone is rooted you can also enable/tick “Global Proxy” to proxify all apps.

5.Do not change other remaining settings of SSH Tunnel application.Leave other settings as it is.Minimise or close this app.

6.Now,use your simcard  on which you want to use free internet.My simcard have 0(zero) balance which I will use for free internet.Now,I will connect internet using this sim .

7.Open Terminal application and change your directory to si folder where you have extracted those files in step 1.My si folder is located at /sdcard/si .So,i will type this on terminal to run the si.py file.Type these commands carefully and correctly:

su

cd /sdcard/si 

8.Now run the si.py script using python command.If everything is correct,SInjector script will be running on your Terminal.It will ask for payload file location(default payload file is payload.ini which we will use),so type n and press enter key.See screenshot.

9.Now,script will ask you “Do you want to disable debug?”, you can enter either y for YES or n for NO.It is your wish.See Screenshot

10.Now,script will ask “Auto Replace 200 OK”, enter y and press Enter key.The Script will show local port  on which the script is accepting connections(in my Screenshot it is listening on port  9000 ).Notice this port carefully as we will use this port in next step.

11.Now,open SSH Tunnel application again and Tick/Enable “Upstream Proxy ” and Put this  in “Proxy “: 127.0.0.1:9000 as SInjector script is listening on port 9000(shown in screenshot).you use your port on which SInjector script is listening.

12.Everything is finally done now.Now,Click on “Tunnel Switch ” in SSH Tunnel app and minimize it(send it to background).

13.Now,open the Terminal app which is already running.If everything is correct and your payload is working for free internet,you will get 200 Connection Established Response  from SSH server as shown in my screenshot.

All steps are completed successfully.Now,you can open any application and use free internet.Your real IP address is hidden as you are using SSH.You can also try to use this SInjector Python script directly and VPN also in the same way.

Happy Free Internet phreaking .

Thanks for reading this long post.I hope my post will be useful for them who are new to Free Internet tricks and who do not know how to use the  SInjector Python script with SSH .

Thanks to everyone and my friends.If you have any questions or you get any error ,please post in Comments.

©gauravssnl