Simple way to share your file’s using python’s SimpleHTTPServer module.

Prerequisite:

python

Command:
python -m SimpleHTTPServer
eg. python -m SimpleHTTPServer 8000

1.If your firewall is enabled then make sure that above port is open

Open new terminal
Checking the connection are listening on port 8000

root@localhost:/# netstat -ncpl |grep 8000
tcp 0 0 0.0.0.0:8000 0.0.0.0:* LISTEN 5330/python
tcp 0 0 0.0.0.0:8000 0.0.0.0:* LISTEN 5330/python
tcp 0 0 0.0.0.0:8000 0.0.0.0:* LISTEN 5330/python
tcp 0 0 0.0.0.0:8000 0.0.0.0:* LISTEN 5330/python
tcp 0 0 0.0.0.0:8000 0.0.0.0:* LISTEN 5330/python
tcp 0 0 0.0.0.0:8000 0.0.0.0:* LISTEN 5330/python

2. Open your browser

python_module

3. To close connection over above mentioned port

press Ctrl + C

root@localhost:/# python -m SimpleHTTPServer 8000
Serving HTTP on 0.0.0.0 port 8000 …
127.0.0.1 – – [08/Nov/2015 08:17:02] “GET / HTTP/1.1” 200 –
127.0.0.1 – – [08/Nov/2015 08:17:02] code 404, message File not found
127.0.0.1 – – [08/Nov/2015 08:17:02] “GET /favicon.ico HTTP/1.1” 404 –
127.0.0.1 – – [08/Nov/2015 08:17:02] code 404, message File not found
127.0.0.1 – – [08/Nov/2015 08:17:02] “GET /favicon.ico HTTP/1.1” 404 –
127.0.0.1 – – [08/Nov/2015 08:17:16] “GET /data/ HTTP/1.1” 200 –
127.0.0.1 – – [08/Nov/2015 08:17:21] “GET /mnt/ HTTP/1.1” 200 –
127.0.0.1 – – [08/Nov/2015 08:17:28] “GET /var/ HTTP/1.1” 200 –
127.0.0.1 – – [08/Nov/2015 08:17:30] “GET /var/tmp/ HTTP/1.1” 200 –
127.0.0.1 – – [08/Nov/2015 08:20:16] “GET /var/www/ HTTP/1.1” 200 –
127.0.0.1 – – [08/Nov/2015 08:20:17] “GET /var/www/emp_reg/ HTTP/1.1” 200 –
127.0.0.1 – – [08/Nov/2015 08:20:19] “GET /var/www/emp_reg/a.php HTTP/1.1” 200 –
127.0.0.1 – – [08/Nov/2015 08:20:24] “GET /proc/ HTTP/1.1” 200 –
127.0.0.1 – – [08/Nov/2015 08:20:24] “GET /proc/149/ HTTP/1.1” 200 –
127.0.0.1 – – [08/Nov/2015 08:20:25] “GET /proc/149/cgroup HTTP/1.1” 200 –
127.0.0.1 – – [08/Nov/2015 08:20:25] “GET /proc/149/cgroup HTTP/1.1” 200 –
127.0.0.1 – – [08/Nov/2015 08:20:34] “GET /bin/ HTTP/1.1” 200 –
127.0.0.1 – – [08/Nov/2015 08:20:36] “GET /bin/bash HTTP/1.1” 200 –
127.0.0.1 – – [08/Nov/2015 08:20:46] “GET / HTTP/1.1” 200 –
^CTraceback (most recent call last):
File “/usr/lib/python2.7/runpy.py”, line 162, in _run_module_as_main
“__main__”, fname, loader, pkg_name)
root@localhost/#

4.Check in Browser again after closing connection over mentioned port.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s