Thursday, 22 May 2014

How to Host Your Own Tor Hidden Service

This is a tutorial on how to securely host and run your own Tor hidden service.

First thing that's required is your own web server and secondly you need to  configure the server in such a way as to prevent any possible information leaks (most importantly your location!).

This tutorial makes use of whonix, which means any accidental leaks (DNS, IP etc.) are highly unlikely. For even better security consider using a dedicated machine for running your web server.

So go ahead, download Whonix Workstation + Gateway. Download VirtualBox,  import the .ova files and fire up your machines. 

On the Whonix Gateway
sudo nano /etc/tor/torrc
#make sure to add the following 2 lines to file, save and exit
HiddenServiceDir /var/lib/tor/hidden_service/ 
HiddenServicePort 80 10.152.152.11:80
How to Host Your Own TOR Hidden Service Restart Tor
sudo service tor@default reload
A a hostname (e.g. 123xuadfuhqwer.onion) has been created! You can obtain it by displaying the contents of the  "hostname" file.
sudo cat /var/lib/tor/hidden_service/hostname
Now that you are done with configuring the Whonix Gateway, switch over to the Whonix Workstation, where we will install our Linux web server. I recommend using lighttpd an open-source web server which has an especially low memory footprint.
sudo apt-get update
sudo apt-get install lighttpd
Browsing to your .onion address will now result in the default lighttpd "placeholder"  and you may proceed to get your content up and running. 
How to Host Your Own tor Hidden Service

Sunday, 18 May 2014

How To Geolocate an IP Address with Python

Python 2.7.3

In order to geolocate an IP address with Python you will need a database to match an IP to a location. I am using the Maxmind database, which is available for free.
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
gunzip GeoLiteCity.dat.gz
Next, we install the Pure Python API for Maxmind's GeoIP databases (https://github.com/appliedsec/pygeoip)
sudo pip install pygeoip
Code
import pygeoip
rawdata = pygeoip.GeoIP('/home/user/GeoLiteCity.dat')
def ipquery(ip):
    data = rawdata.record_by_name(ip)
    country = data['country_name']
    city = data['city']
    longi = data['longitude']
    lat = data['latitude']
    print '[x] '+str(city)+',' +str(country)
    print '[x] Latitude: '+str(lat)+ ', Longitude: '+ str(longi)
Running the code
How To Geolocate an IP with Python

UPDATE - PYTHON 3 (Ubuntu 16.04)

sudo pip3 install pygeoip
Download Maxmind location-data
user@user:~$ cd Desktop
user@user:~/Desktop$ mkdir geolocate
user@user:~/Desktop$ cd geolocate
user@user:~/Desktop/geolocate$ wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
user@user:~/Desktop/geolocate$ gunzip GeoLiteCity.dat.gz

Code (save as geo.py in folder geolocate)

import pygeoip
rawdata = pygeoip.GeoIP('/home/user/Desktop/geolocate/GeoLiteCity.dat')
def ipquery(ip):
    data = rawdata.record_by_name(ip)
    country = data['country_name']
    city = data['city']
    longi = data['longitude']
    lat = data['latitude']
    print ('[x] '+str(city)+',' +str(country))
    print ('[x] Latitude: '+str(lat)+ ', Longitude: '+ str(longi))

#optional

ip = input("What's your ip? ")
print (ipquery(ip))

Run the code

user@user:~/Desktop/geolocate$ python3 geo.py
What's your ip? 207.38.138.230
[x] New York,United States
[x] Latitude: 40.7449, Longitude: -73.9782

Thursday, 15 May 2014

Compiling Vertminer 0.5.2 TheKev's Fork On Ubuntu 12.04

Tried this on Ubuntu 12.04 LTS but it should work on any other Linux OS. Open a terminal.

sudo apt-get install autoconf opencl-headers libcurl4-openssl-dev libtool libncurses5-dev git

git clone https://github.com/thekev/vertminer-gpu.git




Download ADL (http://developer.amd.com/tools-and-sdks/graphics-development/display-library-adl-sdk/)

Unzip and copy files from folder include  to vertminer-gpu/ADL_SDK/ folder

Go back to your terminal.

cd vertminer-gpu
sudo su
libtoolize
autoreconf -ivf
CFLAGS="-O2 -Wall -march=native" ./configure
sh ./buildit.sh

How to download a portion of Youtube Video with youtube-dl

First make you have both youtube-dl and ffmpeg installed: sudo apt install youtube-dl ffmpeg Then download a portion of your desired...