Posts

SCRAPING USING URLLIB

[root@rhel7 html]# python Python 2.7.5  >>> import  urllib >>> f=urllib.urlopen("https://www.microsoft.com") >>> print  f <addinfourl at 140286118192624 whose fp = <socket._fileobject object at 0x7f96f39ed7d0>> >>> f <addinfourl at 140286118192624 whose fp = <socket._fileobject object at 0x7f96f39ed7d0>> Important :  Here f is an object and by using f we can grab lots of info about url which are listed below ####  To get more info about its web page the server name where this page is hosted >>> print f.info() Server:  Apache ETag: "6082151bd56ea922e1357f5896a90d0a:1425454794" Accept-Ranges: bytes Content-Length: 1020 Content-Type: text/html Connection: close X-N: S @@@  To get URL from  f object >>> print  f.geturl() https://www.microsoft.com @@@  To read the page code written in html  p>...

TCPDUMP TRICKS ON REDHAT 7.2

1. To list of all the Interfaces [root@rhel7 Desktop]# tcpdump  -D 1.virbr0 2.docker0 3.enp0s29u1u2 4.vnet0 5.nflog (Linux netfilter log (NFLOG) interface) 6.nfqueue (Linux netfilter queue (NFQUEUE) interface) 7.usbmon1 (USB bus number 1) 8.usbmon2 (USB bus number 2) 9.enp3s0 10.br7 11.any (Pseudo-device that captures on all interfaces) 12.lo 2.  To capture all the packages coming to the interface loop back (lo) [root@rhel7 Desktop]# tcpdump  -i  lo tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on lo, link-type EN10MB (Ethernet), capture size 65535 bytes 3.  To capture all the packet in passing through any interface [root@rhel7 Desktop]# tcpdump  -i  any tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on any, link-type LINUX_SLL (Linux cooked), capture size 65535 bytes 4.  To be verbose while capturing  [root@rhel7 Desktop]# tcpdump...

HOW DOES DNS LOOKUP WORK?

You must have always thought of how does google chrome or any browser find you the information from and show it to you. Here's a wonderful link to understand. https://howdns.works Hope you enjoy and like it!

Pulling our code down on PythonAnywhere For Python-Django

Image
Create your account on www.pythonanywhere.com and then go to Bash Shell. PythonAnywhere command-line $ git clone https://github.com/<your-github-username>/<repo-name>.git PythonAnywhere command-line $ cd repo-name $ virtualenv --python=python3.6 myvenv Running virtualenv with interpreter /usr/bin/python3.6 [...] Installing setuptools, pip...done. $ source myvenv/bin/activate (myvenv) $ pip install django Collecting django [...] Successfully installed django-1.11. (mvenv) $ python manage.py migrate Operations to perform: [...] Applying sessions.0001_initial... OK (mvenv) $ python manage.py createsuperuser

Starting our Git repository

Note   Check your current working directory with a  pwd  (Mac OS X/Linux) or  cd  (Windows) command before initializing the repository.  On Command Line: $ git init Initialized empty Git repository in ~/your-repo/.git/ $ git config --global user.name "Your Name" $ git config --global user.email you@example.com Create a .gitignore file $ git status $ git add --all . $ git commit -m "Some Useful Message." $ git remote add origin https://github.com/<your-github-username>/<repo-name>.git $ git push -u origin master

Install GIT

Git is a "version control system" used by a lot of programmers. This software can track changes to files over time so that you can recall specific versions later. A bit like the "track changes" feature in Microsoft Word, but much more powerful. Installing Git: Windows You can download Git from  git-scm.com . You can hit "next" on all steps except for one; in the fifth step entitled "Adjusting your PATH environment", choose "Use Git and optional Unix tools from the Windows Command Prompt" (the bottom option). Other than that, the defaults are fine. Checkout Windows-style, commit Unix-style line endings is good. Do not forget to restart the command prompt or powershell after the installation finished successfully. Installing Git: Debian or Ubuntu On Command Line: $ sudo apt-get install git