Summary
Versi贸n Espa帽ol
La finalidad de esta librer铆a es la de proporcionar una navegaci贸n an贸nima.
El objetivo de este desarrollo, es el aprendizaje. No nos hacemos responsables del uso indebido de la mismas para fines que no sean puramente lectivos.
- Documento de control versiones:
Versi贸n | Autor | Publicada | Enlace | Descripci贸n |
---|---|---|---|---|
0.1 | Jos茅 F潞 | No | pip | En esta versi贸n disponemos de la funci贸n request_get que haciendo uso de la librer铆a requests y a trav茅s del m茅todo get, obtendr谩 la respuesta de una p谩gina web que enviemos por par谩metro. |
0.2 | Jos茅 F | S铆 | pip | No hay cambios sobre la versi贸n anterior. Se solventan algunos fallos de implementaci贸n. |
Configuraci贸n/Instalaci贸n Tor
Para poder hacer uso de la librer铆a, debemos instalar previamente Tor en nuestras m谩quinas. Para ello, vamos a seguir los siguientes pasos:
-
Update del sistema:
sudo apt update
-
Instalaci贸n de Tor:
sudo apt install -y tor
-
Comprobamos el estado del servicio tras la instalaci贸n:
service tor status
- cannot read PID file /var/run/tor/tor.pid
-
Editamos el fichero de configuraci贸n de Tor:
sudo gedit /etc/tor/torrc
osudo nano /etc/tor/torrc
Buscamos la entrada:
HashedControlPassword
Eliminamos el s铆mbolo # que la precede.
Hacemos lo mismo con las siguientes entradas:
CookieAuthentication
ControlPort
Respecto a la entrada del HashedControlPassword. Para generar el hash que debemos incluir, ser谩 necesario generar uno nuevo a partir del siguiente comando:
tor --hash-password my_password
Importante: es muy conveniente guardar este password ya que ser谩 el que usaremos en la librer铆a de caspertools.
-
Arracamos el servicio de tor:
service tor start
-
Instalaci贸n de netcat: Instalaremos esta librer铆a para comprobar que todo est谩 corercto.
sudo apt install -y netcat
Tras la instalaci贸n, ejecutaremos el siguiente comando:
echo -e 'AUTHENTICATE' | nc 127.0.0.1 9051
Nos deber铆a retornar los siguiente:
(UNKNOWN) [127.0.0.1] 9051 (?) : Connection refused
Esto es debido a que estamos haciendo uso del proxy sin el password generado en el punto 4. Probamos de nuevo incluyendo el password:
echo -e 'AUTHENTICATE "my password"' | nc 127.0.0.1 9051
En este caso, nos retornar谩:
250 OK
Nota: Si hemos ejecutado correctamente los pasos indicados, ya disponemos de Tor instalado y preparado para ser usado desde nuestra librer铆a caspertools.
Como usar caspertools
Caspertools internamente usa la librer铆a stem para regenerar las IPs a trav茅s de TOR. En caso de problemas con la librer铆a de caspertools, se recomienda la instalaci贸n manual de stem haciendo uso del comando:
pip install stem
Caspertools internamente usa la librer铆a requests para realizar las solicitudes por http/s. En caso que problemas con la librer铆a, se recomienda la instalaci贸n manual de requests haciendo uso del comando:
pip install requests
Para usar la librer铆a de navegaci贸n oculta, debemos importar el m贸dulo, para ello, agregremos la siguiente l铆nea a nuestro proyecto:
from caspertools.hiddenav import TorIp
Declararemos una nueva variable que corresponder谩 a la clase TorIp
tor = TorIp(<Tor Password>,<Tor Port>,<Local Proxy>)
En la clase TorIp disponemos de las siguientes funciones:
- renew_ip(): Con esta funci贸n podemos testear que la IP haya cambiado, es decir, solicitamos una nueva IP.
- request_get(): Esta funci贸n nos permite consultar una web con navegaci贸n oculta.
Nota:
Actualmente solo est谩 disponible el m茅todo get. En pr贸ximas versi贸n se implementar谩 tambi茅n el verbo post as铆 como el uso con librer铆as como urllib.
English Version
The objective of this library is made easy hidden navigation.
This development is only for learn. We are not responsible for the incorrect use for finished.
- Documento de control versiones:
Version | Author | Published | Link | Description |
---|---|---|---|---|
0.1 | Jos茅 F潞 | No | pip | In this version we have the request_get function that by using the requests library and through the get method, you will get the response of a web page that we send by parameter. |
0.2 | Jos茅 F | Yes | pip | There are no changes over the previous version. Some implementation failures are resolved. |
Tor Setup / Installation
In order to use the library, we must previously install Tor on our machines. To do this, we will follow the following steps:
-
Sistem update:
sudo apt update
-
Tor Installation:
sudo apt install -y tor
-
We check the service status after installation:
service tor status
- cannot read PID file /var/run/tor/tor.pid
-
Edit the Tor configuration file:
sudo gedit /etc/tor/torrc
orsudo nano /etc/tor/torrc
We look for the entrance:
HashedControlPassword
We remove the # symbol that precedes it.
We do the same with the following entries:
CookieAuthentication
ControlPort
Regarding the entry of the HashedControlPassword. To generate the hash that we must include, it will be necessary to generate a new one from the following command:
tor --hash-password my_password
Important: it is very convenient to save this password as it will be the one we will use in the caspertools library.
-
We start the tor service:
service tor start
-
Netcat installation: We will install this library to verify that everything is correct.
sudo apt install -y netcat
After installation, we will execute the following command:
echo -e 'AUTHENTICATE' | nc 127.0.0.1 9051
We should return the following:
(UNKNOWN) [127.0.0.1] 9051 (?) : Connection refused
This is because we are using the proxy without the password generated in point 4. We test again including the password:
echo -e 'AUTHENTICATE "my password"' | nc 127.0.0.1 9051
In this case, it returns us:
250 OK
Note: If we have executed the indicated steps correctly, we already have Tor installed and prepared to be used from our caspertools library.
How to use caspertools
Caspertools internally uses the stem library to regenerate IPs through TOR. In case of problems with the caspertools library, manual installation of stem using the command is recommended:
pip install stem
Caspertools internally uses the requests library to make requests by http / s. In case of problems with the library, manual installation of requests by using the command is recommended:
pip install requests
To use the hidden navigation library, we must import the module, for this, we will add the following line to our project:
from caspertools.hiddenav import TorIp
We will declare a new variable that corresponds to the TorIp class
tor = TorIp(<Tor Password>,<Tor Port>,<Local Proxy>)
In the TorIp class we have the following functions:
- renew_ip(): With this function we can test that the IP has changed, that is, we request a new IP.
- request_get(): This function allows us to consult a website with hidden navigation.
Note:
Only the get method is currently available. In the next version, the post verb will be implemented as well as the use with libraries such as urllib.