This blog is all about Cyber Security and IT

Friday, February 8, 2019

How to remove Pip install module error in Python







When you are trying to import third party module in your python program , you normally face a challenge like :









For this , no need to worry .





Just go to the your Python IDLE, Right click on the icon . Check the file location.













Go to the file location : Search for script folder









After that copy the location and paste in cmd









Change directory of cmd and install the package









Now you can easily install any package which you want .






Thursday, February 7, 2019

Guessing a Name Game in Python



secreat = "Webha"
Guess =""
Guess_count = 0
i = 3

while secreat != Guess and Guess_count <= 2:
print("You have " + str(i) + " attempts Left ")
Guess = input("Enter your GF name : Hint word is of 5 char \n")
Guess_count += 1
i -= 1
if secreat == Guess:
print("Yes your GF name is : Webha !! you Win")
else:
print("you lost ")






Question Answering using python if-else



# Question Ans using if else

name = input (" Can you please tell me who are you \n " )

print ("Hey welcome " + name + "\n")
ans = input("Could you please tell me more about you Enter :yes/no \n")

if ans == "yes":
age = input("Tell me your age:\n")
int_age = int(age)

if int_age <= 30:
print("Don't lie" + name + "\n")
else:
print("Get Married , You are " + age + "\n")

else:
print("Get lost if you don't want to tell anything")





Wednesday, February 6, 2019

Advanced Calculator in Python



#advanced calculator

num1 = float(input("Enter your first number: "))
op = input("Enter the operator: ")
num2 = float(input("Enter the second number : "))
if op == "+":
print(num1 + num2)
elif op == "-":
print(num1 - num2)
elif op == "/":
print(num1 / num2)
elif op == "*":
print(num1 * num2)

else:
print("Invalid Operator")

















Saturday, January 26, 2019

File Structure in Linux








Most of the people who are new to Linux are confused about directories and File structure on Linux. When you boot any Linux distribution ‘root partition’ is mounted at /. Every files and folder are mounted under /. You don’t find any drive name like (C, D) etc in Linux(if it is not dual booted). Moreover In Linux, program are located in different directories. For examples less command is located under /usr/bin directory. Therefore the directory structure of Linux/Unix is intimidating especially for the users who have migrated from windows.





Difference between Linux and Windows File Structure





In windows almost all the program files are installed in ‘program file” by default unless user specify the specific directory. In Linux directory system are categories on the basis of structure of program. For example configuration files are in /etc, all binary files are in /bin or /usr/bin or /usr/local/bin and so on.





Windows file Structure





\\Folder\\subfolder\\file.txt





Linux File Structure





1/Folder/subfolder/file.txt




The basic difference is:
Linux/Unix always use forward slash to denote filesystem hierarchy whereas windows use backslash.





Understanding File system in Linux/Unix









/bin: 





  • Contains the executable programs that are part of the Linux operating system.
  • Many Linux commands such as cat, cp, ls, more, and tar are located in /bin.
  • Example ls, cat, cp.




/dev:





  • All the devices like input devices, sound card, modems are stored.
  • It is a virtual directory that contains devices files.
  • Example : /dev/udp, /dev/urandom, /dev/sda1




/etc





  • Contains config folder of entire operating system.
  • All the global setting like ssh, telnet, and smtp/pop3 mail servers.
  • Also contains system’s password file like group lists, user skeletons, and cron jobs.
  • Example: /etc/resolv.conf, /etc/logrotate.conf




/home





  • Default directory for users to store the personal files.
  • Example /home/saugat, /home/sachit




/sbin





  • contains binary executables typtically used by system admnistrator only available to root.
  • Mostly used for system maintenance purpose
  • Commands such as mount, shutdown, umount, reside here
  • Example: /sbin/halt/ /sbin/ip6tables




/usr





  • contains shareable and read only data
  • contains binaries, libraries, documentation and source code for second level program




/usr/bin : Contains executable files for many Linux commands. It is not part of the core Linux operating system.
/usr/include : Contains header files for C and C++ programming languages
/usr/lib : Contains libraries for C and C++ programming languages.
/usr/local : Contains local files. It has a similar directories as /usr contains.
/usr/sbin : Contains administrative commands.
/usr/share : Contains files that are shared, like, default configuration files, images, documentation, etc.
/usr/src : Contains the source code for the Linux kernel.
/var
Includes user specific files such as mail message, database of installed programs, log files etc.





/var/cache: Storage area for cached data for applications.
/var/lib: Contains information related to the current state of applications. Programs modify this when they run.
/var/lock: Contains lock files which are checked by applications so that a resource can be used by one application only.
/var/log: Contains log files for different applications.
/var/mail: Contains users emails.
/var/opt: Contains variable data for packages stored in /opt directory.
/var/run: Contains data describing the system since it was booted.
/var/spool: Contains data that is waiting for some kind of processing.
/var/tmp: Contains temporary files preserved between system reboots
/tmp





  • All the temporary files are store here.
  • The files under this directory are deleted when system is rebooted.
  • For example: when new program is installed it use /tmp/ to put files during installation that won’t be needed after the program is installed.




/mnt





  • Default location for mouting devices like cdrooms, floppy disk dries, USB memory sticks etc.
  • Example : /mnt/cdroom




/proc





  • contains information about system process
  • virtual file system that contains information about file system.
  • Example /proc/cpuinfo, /proc/swaps




/lib





  • share libraries are stored(perl, python, C, etc.)
  • /lib/ are also a kernel modules
  • Example: ld-2.11.1.so, libncurses.so.5.7




/opt





  • Config file for add on Application software are found here.
  • Third party application should be installed in this directory.




/root





  • Home directory of system administrator.’root’.
  • Root user has write privilege under this directory




/boot





  • Contains everything required for boot process.
  • Stores data that is used before the kernel begins executing user-mode program.
  • Example: /boot/boot.b, /boot/chain.b, /boot/config-kernel-version