Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Programs:
- ///////////////////////////////Caesar Cipher:
- # encrypt and decrypt a text using a simple algorithm of offsetting the letters
- key = 'abcdefghijklmnopqrstuvwxyz'
- def encrypt(n, plaintext):
- """Encrypt the string and return the ciphertext"""
- result = ''
- for l in plaintext.lower():
- try:
- i = (key.index(l) + n) % 26
- result += key[i]
- except ValueError:
- result += l
- return result.lower()
- def decrypt(n, ciphertext):
- """Decrypt the string and return the plaintext"""
- result = ''
- for l in ciphertext:
- try:
- i = (key.index(l) - n) % 26
- result += key[i]
- except ValueError:
- result += l
- return result
- text = "I am coding Python on SoloLearn!"
- offset = 5
- encrypted = encrypt(offset, text)
- print('Encrypted:', encrypted)
- decrypted = decrypt(offset, encrypted)
- print('Decrypted:', decrypted)
- ////////////////////////////Transposition Cipher
- // CPP program for illustrating
- // Columnar Transposition Cipher
- #include<bits/stdc++.h>
- using namespace std;
- // Key for Columnar Transposition
- string const key = "HACK";
- map<int,int> keyMap;
- void setPermutationOrder()
- {
- // Add the permutation order into map
- for(int i=0; i < key.length(); i++)
- {
- keyMap[key[i]] = i;
- }
- }
- // Encryption
- string encryptMessage(string msg)
- {
- int row,col,j;
- string cipher = "";
- /* calculate column of the matrix*/
- col = key.length();
- /* calculate Maximum row of the matrix*/
- row = msg.length()/col;
- if (msg.length() % col)
- row += 1;
- char matrix[row][col];
- for (int i=0,k=0; i < row; i++)
- {
- for (int j=0; j<col; )
- {
- if(msg[k] == '\0')
- {
- /* Adding the padding character '_' */
- matrix[i][j] = '_';
- j++;
- }
- if( isalpha(msg[k]) || msg[k]==' ')
- {
- /* Adding only space and alphabet into matrix*/
- matrix[i][j] = msg[k];
- j++;
- }
- k++;
- }
- }
- for (map<int,int>::iterator ii = keyMap.begin(); ii!=keyMap.end(); ++ii)
- {
- j=ii->second;
- // getting cipher text from matrix column wise using permuted key
- for (int i=0; i<row; i++)
- {
- if( isalpha(matrix[i][j]) || matrix[i][j]==' ' || matrix[i][j]=='_')
- cipher += matrix[i][j];
- }
- }
- return cipher;
- }
- // Decryption
- string decryptMessage(string cipher)
- {
- /* calculate row and column for cipher Matrix */
- int col = key.length();
- int row = cipher.length()/col;
- char cipherMat[row][col];
- /* add character into matrix column wise */
- for (int j=0,k=0; j<col; j++)
- for (int i=0; i<row; i++)
- cipherMat[i][j] = cipher[k++];
- /* update the order of key for decryption */
- int index = 0;
- for( map<int,int>::iterator ii=keyMap.begin(); ii!=keyMap.end(); ++ii)
- ii->second = index++;
- /* Arrange the matrix column wise according
- to permutation order by adding into new matrix */
- char decCipher[row][col];
- map<int,int>::iterator ii=keyMap.begin();
- int k = 0;
- for (int l=0,j; key[l]!='\0'; k++)
- {
- j = keyMap[key[l++]];
- for (int i=0; i<row; i++)
- {
- decCipher[i][k]=cipherMat[i][j];
- }
- }
- /* getting Message using matrix */
- string msg = "";
- for (int i=0; i<row; i++)
- {
- for(int j=0; j<col; j++)
- {
- if(decCipher[i][j] != '_')
- msg += decCipher[i][j];
- }
- }
- return msg;
- }
- // Driver Program
- int main(void)
- {
- /* message */
- string msg = "Geeks for Geeks";
- setPermutationOrder();
- // Calling encryption function
- string cipher = encryptMessage(msg);
- cout << "Encrypted Message: " << cipher << endl;
- // Calling Decryption function
- cout << "Decrypted Message: " << decryptMessage(cipher) << endl;
- return 0;
- }
- //////////////////////////////Auto_key substitution cipher
- import math
- import random
- def subscipher_encrypt(msg,key):
- msg = "".join(msg.split(' '))
- msg = msg.lower()
- m = list(msg)
- stage1 = [ord(i) - ord('a') for i in m]
- stage2 = [key]
- stage2.extend(stage1[:-1])
- stage3 = [i+j for i,j in zip(stage1,stage2)]
- stage4 = [i%26 for i in stage3]
- stage5 = [chr(i+ord('a')) for i in stage4]
- cipher = "".join(stage5).upper()
- return cipher
- def subscipher_decrypt(cipher,key):
- m = list(cipher)
- stage1 = [ord(i)-ord('A') for i in m]
- stage2 = [(stage1[0]-key)%26]
- for i in range(1,len(m)):
- stage2.append((stage1[i] - stage2[i-1]) % 26)
- stage3 = [chr(i + ord('A')) for i in stage2]
- plain = "".join(stage3)
- return plain
- if __name__ == '__main__':
- message = input("Enter the message : ")
- key = random.randint(50,100)
- ct = subscipher_encrypt(message,key)
- print("encrypted text is : ",ct)
- pt = subscipher_decrypt(ct,key)
- print("Decrypted text is : ",pt)
- //////////////////////Keyless Transposition Cipher
- ''' Keyless Transposition Cipher '''
- import math
- #WORKING
- ''' e.g. message is 'Python' to be transposed
- In keyless trans.n message is split into 2 rows having alternate characters of message
- 1st row --> | P | | T | | O | |
- 2nd row --> | | Y | | H | | N |
- The transposed message will be all characters of 1st row then of the 2nd row
- i.e. --> 'PTOYHN'
- '''
- def encrTrans(m):
- #For storing characters present at even indices
- even = []
- #For storing characters present at odd indices
- odd = []
- for i in range(0,len(m)):
- if(i%2 == 0):
- even.append(m[i])
- else:
- odd.append(m[i])
- tlist = even + odd
- #returning list elements as a single string
- return "".join(tlist)
- def decrTrans(tlist):
- decryptedList = []
- #halflength means till all the characters which were in the 1st row
- halflength = math.ceil(len(tlist)/2)
- #Now we will append characters in decryptedList alternately from 1st half and 2nd half of tlist
- for i in range(0,halflength):
- decryptedList.append(tlist[i])
- if(halflength+i > len(tlist)-1):
- break
- else:
- decryptedList.append(tlist[halflength+i])
- return decryptedList
- if __name__ == '__main__':
- message = input("Enter the message : ")
- #Removing spaces if present in the message
- message = "".join(message.split(' '))
- transposedmsg = encrTrans(message)
- print("Transposed message is : ",transposedmsg)
- decryptedmsg = decrTrans(transposedmsg)
- print("Decrypted message is : ","".join(decryptedmsg))
- ////////////////////firewall using Iptables
- *************list rules
- iptables -L
- *****block ping request (add rule)
- $ sudo iptables -A INPUT -p icmp --icmp-type echo-request -j REJECT
- ********unblock ping request (delete rule)
- $ sudo iptables -D INPUT -p icmp --icmp-type echo-request -j REJECT
- ***********block websites
- iptables -A OUTPUT -p tcp -m string --string "sitename.com" --algo kmp -j REJECT
- ***********unblock websites
- iptables -D OUTPUT -p tcp -m string --string "sitename.com" --algo kmp -j REJECT
- ////////////////////////////DEFFI HELLMAN
- ******************server.py
- import random
- import socket
- def send_R2_receive_R1(R2):
- try:
- host = 'localhost'
- port = 6766
- s = socket.socket()
- s.bind((host, port))
- s.listen(1)
- c, addr = s.accept()
- data = c.recv(1024)
- data1 = str(R2)
- c.send(data1.encode())
- return int(str(data.decode()))
- finally:
- c.close()
- def check_primitive(g,p):
- another_set=set()
- for e in range(1,p):
- another_set.add(pow(g,e,p))
- for i in range(1,p):
- if i not in another_set:
- return False
- return True
- if __name__ == '__main__':
- g, p=int(input("Enter g:")), int(input("Enter p:"))
- if not check_primitive(g,p):
- print(g," is not primitive root of ",p,sep="")
- else:
- #x = random.randint(1,p)
- y = random.randint(1,p)
- #R1 = pow(g,x,p)
- R2 = pow(g,y,p)
- print("Found R2 =",R2)
- R1 = send_R2_receive_R1(R2)
- print("Received R1 =",R1)
- key = pow(R1,y,p)
- print("Key =",key)
- *************************client .py
- import random
- import socket
- def send_R1_receive_R2(R1):
- host = 'localhost'
- port = 6766
- s = socket.socket()
- s.connect((host, port))
- R1 = str(R1)
- s.send(R1.encode())
- data = s.recv(1024)
- data = data.decode()
- s.close()
- return int(data)
- def check_primitive(g,p):
- another_set=set()
- for e in range(1,p):
- another_set.add(pow(g,e,p))
- for i in range(1,p):
- if i not in another_set:
- return False
- return True
- if __name__ == '__main__':
- g, p=int(input("Enter g:")), int(input("Enter p:"))
- if not check_primitive(g,p):
- print(g," is not primitive root of ",p,sep="")
- else:
- x = random.randint(1,p)
- #y = random.randint(1,p)
- R1 = pow(g,x,p)
- print("Found R1 =",R1)
- #R2 = pow(g,y,p)
- R2 = send_R1_receive_R2(R1)
- print("Received R2 =",R2)
- key = pow(R2,x,p)
- print("Key =",key)
- ////////////////////////////RSA.py
- import math
- from sympy import factorint #pip install sympy
- factors=[]
- power=[]
- '''
- def isPrime(p):
- for i in range(2,p//2+1):
- if p%i==0:
- return False
- return True
- def factorize(m):
- i=2
- k=0
- while (i<=m):
- if(isPrime(i)):
- if m%i==0:
- factors.append(i)
- power.append(0)
- while m%i==0:
- power[k]+=1
- m=m//i
- k+=1
- i+=1
- print(factors)
- print(power)
- '''
- def calc_phi():
- phi=1
- for i in range(0,len(factors)):
- if power[i]>1:
- phi*=(pow(factors[i], power[i]) - pow(factors[i], power[i]-1))
- elif power[i]==1:
- phi*=(factors[i]-1)
- return phi
- def mul_inv(e,n):
- if(math.gcd(e,phi)==1):
- r1=phi
- r2=e
- t1=0
- t2=1
- while(r2!=0):
- q=r1//r2
- r=r1%r2
- t=t1-q*t2
- r1=r2
- r2=r
- t1=t2
- t2=t
- if t1>0:
- return t1
- else:
- return t1%phi
- else:
- return -1
- def encrypt(s,e,n):
- c=pow(s,e,n)
- return c
- def decrypt(c,e,n):
- p=pow(c,d,n)
- return p
- print("RSA key generation:")
- print("1. Encryption with public key")
- print("2. Encryption with private key(Digital Signature)")
- ch=int(input("Enter your choice:"))
- n=int(input("Enter n:"))
- print("n:",n)
- #factorize(n)
- fact=factorint(n)
- factors=list(fact.keys())
- power=list(fact.values())
- print(factors)
- print(power)
- phi=calc_phi()
- d=-1
- while d==-1:
- e=int(input("Enter e:"))
- print("e:",e)
- d=mul_inv(e,n)
- if d==-1:
- print("Multiplicative inverse doesn't exist. Try again.")
- print("d:",d)
- if ch==1:
- print("Public Key: (", n, ",", e, ")")
- print("Private Key: (", n, ",", d, ")")
- else:
- print("Private Key: (", n, ",", e, ")")
- print("Public Key: (", n, ",", d, ")")
- s=int(input("Enter the plain text:"))
- c=encrypt(s,e,n)
- print("encrypted text : ",c)
- p=decrypt(c,e,n)
- print("decrypted text : ",p)
- /////////////////////////////PRODUCT CIPHER .JAVA
- import java.io.*;
- import java.util.*;
- class ProductCipher
- {
- public static void main(String args[]) throws IOException
- {
- int itr=3;
- Scanner sc=new Scanner(System.in);
- System.out.println("Enter plain text:");
- String pt=sc.nextLine();
- pt=pt.toUpperCase();
- pt=pt.replaceAll("\\s", "");
- System.out.println("The plain text is: "+pt);
- System.out.println("Enter the key:");
- int key = sc.nextInt();
- System.out.println("Cipher Text generated using substitution technique is : ");
- char ct[] = pt.toCharArray();
- for(int x=0; x<itr; x++){
- for( int i=0;i<ct.length;i++)
- {
- ct[i] = (char)((key+(int)ct[i]-65)%26+65);
- }
- System.out.println("Substitution Cipher result after round "+(x+1)+":");
- for( int i=0;i<ct.length;i++)
- {
- System.out.print(ct[i]);
- }
- System.out.println();
- }
- System.out.println();
- System.out.println();
- System.out.println();
- String pt1 = new String(ct);
- System.out.println("Plaintext to Transformation Technique is :" + pt1);
- System.out.println("Enter the key:");
- int k= sc.nextInt();
- char a[] = pt1.toCharArray();
- int l,t;
- l=a.length;
- t=l;
- int m=0,i,j;
- if(l%k==0)
- l=l/k;
- else
- l=l/k+1;
- char b[][]=new char[l][k];
- for( i=0;i<l;i++)
- { for( j=0;j<k;j++)
- {if(m==t)
- b[i][j]='#';
- else
- { b[i][j]=a[m];
- m++;
- }
- }
- }
- System.out.println("Entered text in matrix form is : ");
- for(i=0;i<l;i++)
- { for(j=0;j<k;j++)
- { System.out.print(b[i][j]);
- }
- System.out.println();
- }
- System.out.println("Cipher Text is");
- String finalCipherText="";
- for(i=0;i<k;i++)
- { for(j=0;j<l;j++)
- {
- finalCipherText+=(Character.toString(b[j][i]));
- //System.out.print(b[j][i]);
- }
- }
- System.out.println(finalCipherText);
- //Lets decrypt the text
- System.out.println("Starting to decrypt:");
- for(i=0;i<k;i++)
- { for(j=0;j<l;j++)
- { System.out.print(b[j][i]);
- }
- System.out.println();
- }
- String transpositionText="";
- for(i=0;i<l;i++)
- { for(j=0;j<k;j++)
- {
- transpositionText+=(Character.toString(b[i][j]));
- //System.out.print(b[i][j]);
- }
- }
- int temp;
- char ct1[] = transpositionText.toCharArray();
- for(int x=0; x<itr; x++){
- for(i=0;i<ct1.length;i++)
- {
- temp=(int)ct1[i];
- ct1[i] = (char)((temp-key-65)%26+65);
- }
- System.out.println("Decryption Round "+(x+1)+":");
- for(i=0;i<ct.length;i++)
- {
- System.out.print(ct1[i]);
- }
- System.out.println();
- }
- System.out.println("Entered text was:");
- for(i=0;i<ct.length;i++)
- {
- System.out.print(ct1[i]);
- }
- }//End of main
- }//End of class
- ////////////////////////////// hping
- sudo hping3 192.168.37.56
- sudo hping3 -c 10000 --flood --rand-source 192.168.37.56
- sudo hping3 -c 10 192.168.36.193
- sudo hping3 -c 10 -d 120 192.168.36.193
- sudo hping3 -1 -c 10 -a 192.168.36.193 192.168.37.56
- ///////////////////////////COMMANDS
- ifconfig
- whois 192.168.39.187
- dig www.google.com OR dig google.com +short
- traceroute www.google.com
- dig 192.168.39.187
- Clear
- nslookup google.com
- sudo netstat -plnt
- netstat -r
- Find ves public ip address? -
- dig ves.ac.in
- OS version using nmap-
- $ sudo nmap -v -Pn -O 192.168.45.151
- --------------------------------------------------------------------------------------------------
- nmap google.com
- sudo nmap -O google.com
- sudo nmap -sX google.com
- sudo iptables -A INPUT -s 192.168.40.11 -j DROP
- sudo iptables -A INPUT -s 192.168.40.11 -j ACCEPT
- whois www.google.com
- dig www.google.com
- /////////////////////////CODE FOR BUFFER OVERFLOW
- #include<stdio.h>
- int main(){
- int arr[] = {47,58,32};
- printf("%d\n", arr[0]);
- printf("%d\n", arr[20]);
- return 0;
- }
- ///////////////////////////////GPG
- GPG
- Installing GPG
- lab308-3@Shubham:~$ sudo apt-get update
- [sudo] password for lab308-3:
- Hit:1 http://ppa.launchpad.net/certbot/certbot/ubuntu xenial InRelease Hit:2 http://security.ubuntu.com/ubuntu xenial-security InRelease Hit:3 http://in.archive.ubuntu.com/ubuntu xenial InRelease
- Hit:4 http://ppa.launchpad.net/danielrichter2007/grub-customizer/ubuntu xenial InRelease Hit:5 http://in.archive.ubuntu.com/ubuntu xenial-updates InRelease
- Hit:6 http://in.archive.ubuntu.com/ubuntu xenial-backports InRelease Hit:7 http://ppa.launchpad.net/gns3/ppa/ubuntu xenial InRelease
- Hit:8 http://ppa.launchpad.net/otto-kesselgulasch/gimp/ubuntu xenial InRelease Reading package lists... Done
- lab308-3@Shubham:~$ sudo apt-get install gnupg
- Reading package lists... Done
- Building dependency tree
- Reading state information... Done
- gnupg is already the newest version (1.4.20-1ubuntu3.3).
- 0 upgraded, 0 newly installed, 0 to remove and 141 not upgraded.
- lab308-3@Shubham:~$ gpg --gen-key
- gpg (GnuPG) 1.4.20; Copyright (C) 2015 Free Software Foundation, Inc.
- This is free software: you are free to change and redistribute it.
- There is NO WARRANTY, to the extent permitted by law.
- Key Generation
- lab308-3@Shubham:~$ gpg --gen-key
- gpg (GnuPG) 1.4.20; Copyright (C) 2015 Free Software Foundation, Inc.
- This is free software: you are free to change and redistribute it.
- There is NO WARRANTY, to the extent permitted by law.
- Please select what kind of key you want:
- (1) RSA and RSA (default)
- (2) DSA and Elgamal
- (3) DSA (sign only)
- (4) RSA (sign only)
- Your selection? 1
- RSA keys may be between 1024 and 4096 bits long.
- What keysize do you want? (2048) 4096
- Requested keysize is 4096 bits
- Please specify how long the key should be valid.
- 0 = key does not expire
- <n> = key expires in n days
- <n>w = key expires in n weeks
- <n>m = key expires in n months
- <n>y = key expires in n years
- Key is valid for? (0) 1y
- Key expires at Tuesday 17 March 2020 08:41:50 AM IST
- Is this correct? (y/N) y
- You need a user ID to identify your key; the software constructs the user ID from the Real Name, Comment and Email Address in this form:
- "Heinrich Heine (Der Dichter) <heinrichh@duesseldorf.de>"
- Real name: Stephen Grinder
- Email address: 2016.stephen.grinder@ves.ac.in
- Comment: Stephen
- You selected this USER-ID:
- "Stephen Grinder (Stephen) <2016.stephen.grinder@ves.ac.in>"
- Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? O
- You need a Passphrase to protect your secret key.
- We need to generate a lot of random bytes. It is a good idea to perform some other action (type on the keyboard, move the mouse, utilize the disks) during the prime generation; this gives the random number generator a better chance to gain enough entropy.
- Not enough random bytes available. Please do some other work to give the OS a chance to collect more entropy! (Need 203 more bytes)
- .........+++++
- Not enough random bytes available. Please do some other work to give the OS a chance to collect more entropy! (Need 11 more bytes)
- .........+++++
- We need to generate a lot of random bytes. It is a good idea to perform some other action (type on the keyboard, move the mouse, utilize the disks) during the prime generation; this gives the random number generator a better chance to gain enough entropy.
- Not enough random bytes available. Please do some other work to give the OS a chance to collect more entropy! (Need 178 more bytes) .+++++
- Not enough random bytes available. Please do some other work to give the OS a chance to collect more entropy! (Need 243 more bytes)
- .......+++++
- gpg: /home/lab308-3/.gnupg/trustdb.gpg: trustdb created
- gpg: key 7EDF0433 marked as ultimately trusted
- public and secret key created and signed.
- gpg: checking the trustdb
- gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model
- gpg: depth: 0 valid: 1 signed: 0 trust: 0-, 0q, 0n, 0m, 0f, 1u
- gpg: next trustdb check due at 2020-03-17
- pub 4096R/7EDF0433 2019-03-18 [expires: 2020-03-17]
- Key fingerprint = 8A72 FEAC 9855 2574 4ED5 0A91 D06F 2B3F 7EDF 0433
- uid Stephen Grinder (Stephen) <2016.stephen.grinder@ves.ac.in>
- sub 4096R/8D3D2327 2019-03-18 [expires: 2020-03-17]
- Create a Revocation Certificate
- lab308-3@Shubham:~$ gpg --output ~/revocation.crt --gen-revoke 2016.stephen.grinder@ves.ac.in
- sec 4096R/7EDF0433 2019-03-18 Stephen Grinder (Stephen) <2016.stephen.grinder@ves.ac.in>
- Create a revocation certificate for this key? (y/N) y
- Please select the reason for the revocation:
- 0 = No reason specified
- 1 = Key has been compromised
- 2 = Key is superseded
- 3 = Key is no longer used
- Q = Cancel
- (Probably you want to select 1 here)
- Your decision? 0
- Enter an optional description; end it with an empty line:
- >
- Reason for revocation: No reason specified
- (No description given)
- Is this okay? (y/N) y
- You need a passphrase to unlock the secret key for
- user: "Stephen Grinder (Stephen) <2016.stephen.grinder@ves.ac.in>"
- 4096-bit RSA key, ID 7EDF0433, created 2019-03-18
- ASCII armored output forced.
- Revocation certificate created.
- Please move it to a medium which you can hide away; if Mallory gets access to this certificate he can use it to make your key unusable. It is smart to print this certificate and store it away, just in case
- your media become unreadable. But have some caution: The print system of your machine might store the data and make it available to others!
- lab308-3@Shubham:~$ chmod 600 ~/revocation.crt
- Listing all generated keys
- stephen@stephen:~$ gpg --
- list-secret-keys
- /home/stephen/.gnupg/secring.gpg
- -----------------------------
- sec 2048R/84C7D581 2019-03-31 [expires: 2020-03-30]
- uid Stephen Grinder (Stephen) <2016.stephen.grinder@ves.ac.in>
- ssb 2048R/46ECE634 2019-03-31
- Send your public key as a file to the recipient
- stephen@stephen:~$ gpg -- armor --output mypubkey.gpg export 2016.stephen.grinder@ves.ac.in--
- stephen@stephen:~$ gpg mypubkey.gpg
- pub 2048R/84C7D581 2019-03-31 Stephen Grinder (Stephen) <2016.stephen.grinder@ves.ac.in> sub 2048R/46ECE634 2019-03-31 [expires: 2020-03-30]
- Friend sends his/her public key to you
- stephen@stephen:~$ gpg --import mypubkey.gpg
- gpg: key 84C7D581: "Stephen Grinder (Stephen) <2016.stephen.grinder@ves.ac.in>" not changed
- gpg: Total number processed: 1
- gpg: unchanged: 1
- Encryption
- stephen@stephen:~$ gpg --encrypt --sign --armor -r 2016.stephen.grinder@ves.ac.in abc.txt You need a passphrase to unlock the secret key for
- user: "Stephen Grinder (Stephen) <2016.stephen.grinder@ves.ac.in>"
- 2048-bit RSA key, ID 84C7D581, created 2019-03-31
- Decryption
- stephen@stephen:~$ gpg abc.txt.asc
- You need a passphrase to unlock the secret key for
- user: "Stephen Grinder (Stephen) <2016.stephen.grinder@ves.ac.in>"
- 2048-bit RSA key, ID 46ECE634, created 2019-03-31 (main key ID 84C7D581)
- gpg: encrypted with 2048-bit RSA key, ID 46ECE634, created 2019-03-31 "Stephen Grinder (Stephen) <2016.stephen.grinder@ves.ac.in>"
- File `abc.txt' exists. Overwrite? (y/N) y
- gpg: Signature made Sunday 31 March 2019 07:52:23 PM IST using RSA key ID 84C7D581
- gpg: Good signature from "Stephen Grinder (Stephen) <2016.stephen.grinder@ves.ac.in>"
- //////////////////////////////SQLMAP
- SQLMAP -U SITENAME -D ACUART -TABLES
- http://testphp.vulnweb.com/listproducts.php?cat=*
- sqlmap -u http://testphp.vulnweb.com/listproducts.php?cat=* --dbs
- Sladyn
- TO get all info about a website
- sqlmap -u http://testphp.vulnweb.com/listproducts.php?cat=1 --dbs
- to get info about a particular table
- sqlmap -u http://testphp.vulnweb.com/listproducts.php?cat=1 -D acuart --tables
- to list data in a specific column
- sqlmap -u http://testphp.vulnweb.com/listproducts.php?cat=1 -D acuart -T artists --columns
- infot in a column
- sqlmap -u http://testphp.vulnweb.com/listproducts.php?cat=1 -D acuart -T artists -C aname --dump
- /////////////////////MD5 Number 5
- import hashlib
- import time
- import os
- import math
- md=open("hii.txt","r")
- data=md.read()
- print('Length of input data is :',len(data))
- start = time.clock()
- result = hashlib.md5(data.encode())
- print(result.hexdigest())
- a=len(result.hexdigest())
- end = time.clock()
- print('length of encoded data using md5',a)
- print("time required :",end-start)
- ///////////////////SHA
- import hashlib
- import time
- # initializing string
- str1 = "Hi"
- input_length=len(str1)
- start_time=time.time()
- # then sending to SHA1()
- result = hashlib.sha1(str1.encode())
- print("The hexadecimal equivalent of SHA1 is : ")
- print(result.hexdigest())
- end_time=time.time()
- print('length of input string',input_length)
- print('length of output string',result.digest_size)
- print('Start time =',start_time)
- print('End_time=',end_time)
- print('Total time required =',(end_time-start_time))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement