Skip to content

Commit 04ecbf2

Browse files
Merge pull request #1 from sanscript-tech/main
update
2 parents 800ff92 + 813a9be commit 04ecbf2

File tree

170 files changed

+6751
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

170 files changed

+6751
-0
lines changed

C++/program-timing/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Script to check program timing
2+
- - - - - - - - - - - - - -
3+
The aim of this script is to check how long a program is running in seconds and milli seconds.
4+
5+
# To use
6+
Simply run the ```time_script.cpp``` file and define the required functions. Then functions can be called between</br>
7+
```auto start clock``` and ```auto stop clock```
8+
9+
# Example
10+
11+
![alt-text](https://github.com/TaniaMalhotra/hacking-tools-scripts/blob/program-timing/C%2B%2B/program-timing/Screenshot.png)

C++/program-timing/Screenshot.png

18.1 KB
Loading

C++/program-timing/time_script.cpp

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#include<vector>
2+
#include <algorithm>
3+
#include <chrono>
4+
#include <iostream>
5+
using namespace std;
6+
using namespace std::chrono;
7+
int my_function()
8+
{
9+
//This function contains the code whose execution time you wish to friend
10+
int num1;
11+
int num2;
12+
cout<<"Enter num1"<<endl;
13+
cin>>num1;
14+
cout<<"Enter num2"<<endl;
15+
cin>>num2;
16+
cout<<"Addition of first and second number is "<<num1+num2<<endl;
17+
cout<<" "<<endl;
18+
19+
}
20+
21+
int main()
22+
{
23+
// Starting the clock
24+
auto start_clock = high_resolution_clock::now();
25+
my_function();
26+
27+
// Stopping the clock
28+
auto stop_clock = high_resolution_clock::now();
29+
30+
//time in seconds
31+
auto duration_in_seconds = duration_cast<seconds>(stop_clock - start_clock);
32+
33+
//converting time to microseconds
34+
auto duration_in_milliseconds = duration_cast<microseconds>(stop_clock - start_clock);
35+
36+
cout <<"The amount of time taken to execute your function in milliseconds is "<< duration_in_milliseconds.count() << " microseconds" << endl;
37+
cout <<"The amount of time taken to execute your function in seconds is "<< duration_in_seconds.count() << " seconds" << endl;
38+
39+
return 0;
40+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Chinese Remainder Theorem
2+
we are given k numbers which are pairwise coprime, and given remainders of these numbers when an unknown number x is divided by them. We need to find the minimum possible value of x that produces given remainders.
3+
4+
## sample input/output:
5+
Enter size of array:3 <br />
6+
Enter value of coprime numbers:3 <br />
7+
4 <br />
8+
5 <br />
9+
Enter value of remainders:2 <br />
10+
3 <br />
11+
1 <br />
12+
Minimum number found is 11 <br />
13+
14+
## Relevance in Cryptography:
15+
CRT based secured encryption scheme is fast and easy to implement. <br />
16+
Below is the link of a paper published by IEEE explaining how CRT is a good alternate encryption system to deal with multiple secrets and users. <br />
17+
https://ieeexplore.ieee.org/document/6194470

C/chinese_remainder_theorem/CRT.c

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
//CRT Implementation using formula:
2+
//x = ( sigma(rem[i]*pp[i]*inv[i]) ) % prod Where 0 <= i <= n-1
3+
4+
#include <stdio.h>
5+
//function to apply CRT for given arrays
6+
int result( int arr[], int rem[], int s)
7+
{
8+
int prod = 1, pp[s], inv[s], k, count, x = 0, i;
9+
//product of coprime numbers in a given array
10+
for (i = 0; i < s; i++)
11+
{
12+
prod = prod * arr[i];
13+
}
14+
//pp[i] product of all divided by each array element
15+
for (i = 0; i < s; i++)
16+
{
17+
pp[i] = prod / arr[i];
18+
}
19+
//inv[i] is modular multiplicative inverse of pp[i] with respect to arr[i]
20+
for (i = 0; i < s; i++)
21+
{
22+
count = 1;
23+
k = 1;
24+
while(count)
25+
{
26+
if(((pp[i] % arr[i]) * k) % arr[i] == 1)
27+
{
28+
inv[i] = k;
29+
count=0;
30+
}
31+
k++;
32+
}
33+
}
34+
for (i = 0; i < s; i++)
35+
{
36+
x = x + (rem[i] * pp[i] * inv[i]);
37+
}
38+
x = x % prod;
39+
return x;
40+
}
41+
42+
int main()
43+
{
44+
int s, i, arr[100], rem[100];
45+
printf("Enter size of array:");
46+
scanf("%d",&s);
47+
//input array of coprime numbers
48+
printf("Enter value of coprime numbers:");
49+
for (i = 0; i < s; i++ )
50+
{
51+
scanf("%d", &arr[i]);
52+
}
53+
//input array of remainders
54+
printf("Enter value of remainders:");
55+
for (i = 0; i < s; i++ )
56+
{
57+
scanf("%d", &rem[i]);
58+
}
59+
printf("Minimum number found is %d", result( arr, rem, s));
60+
return 0;
61+
}
62+
63+
//time_complexity:O(n^2) {worst}
64+
//space_complexity:O(n)

Java/ChineseRemainderTheorem/CRT.java

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import java.io.*;
2+
import java.util.*;
3+
4+
//Assumptions for CRT:divisors are pairwise co-prime, i.e gcd of every pair is 1
5+
class CRT
6+
{
7+
8+
static int solve(int[] div,int[] rem,int n)
9+
{
10+
int A = 1;//result initialized
11+
while(true)
12+
{
13+
int i;
14+
for (i=0;i<n;i++)
15+
{
16+
//checking for all i up to n whether A%div[i]==rem[i]
17+
if (A%div[i]!=rem[i])
18+
break;
19+
}
20+
21+
//if i==n,i.e,A%div[i] for all i is equal to corresponding rem[i] and then A is returned
22+
if (i==n)
23+
return A;
24+
//if i is not equals to n,that means for some i the condition fails,so next value should be checked for A
25+
A++;
26+
}
27+
28+
}
29+
30+
// Driver method
31+
public static void main(String args[])
32+
{
33+
/*Given two arrays div and rem,we need to find out the minimum number 'A'
34+
,for which when the number of div array is divided it gives the
35+
corresponding value present in rem array*/
36+
37+
//Taking input the length of the div array
38+
Scanner sc =new Scanner(System.in);
39+
40+
int n=sc.nextInt();
41+
int div[]=new int[n];
42+
int rem[]=new int[n];
43+
44+
for(int i=0;i<n;i++)
45+
{
46+
div[i]=sc.nextInt();
47+
}
48+
49+
for(int i=0;i<n;i++)
50+
{
51+
rem[i]=sc.nextInt();
52+
}
53+
54+
System.out.println("A : " + solve(div, rem, n)); //Output
55+
}
56+
}
57+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<h2>Sample Input:</h2>
2+
div: 5 6 7
3+
rem: 1 3 2
4+
5+
<h2>Sample Output:</h2>
6+
51
7+
8+
<h2>Explaination:</h2git>
9+
51 % 5 =1
10+
51 % 6 =3
11+
51 % 7 =2
12+
13+
Time Complexity:O(Product of all elements of div array)
14+
15+
-->Objective of CRT is to find the minimum value A,for which when the values divided by A gives the value present in the rem array.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
RELEVANCE IN CRYPTOGRAPHY:
2+
3+
In simple words, Chinese remainder theorem will determine a number pp that, when divided by some given
4+
divisors, leaves given remainders.
5+
6+
Cyber Security is a hot topic these days. Many complex algorithms are used for cyber security and maintenance of the breach.Chinese remainder theorem plays a big role in important algorithms.Cryptography is a collection of techniques applied for secure online communication.One of widely used method is Encryption.Encryption is a phenomena, in which messages and information are encoded such that only authorized people can access and understand it.
7+
8+
Chinese remainder theorem is used by the experts for implementation in the RSA(Rivest–Shamir–Adleman)
9+
cryptosystem, a widely used public-key system for secure data transmission. The optimization for decryption is based on the Chinese remainder theorem, to be precise, it produces and stores values as part of a private key.
10+
11+
Moreover, the theorem is used in secret sharing to assure the impossibility of recovering the secret from a set of shares as long as that set has less than a certain number of elements.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import java.io.*;
2+
import java.util.*;
3+
4+
class PrimeFactorization
5+
{
6+
public static void main(String[] args)
7+
{
8+
Scanner sc=new Scanner(System.in); //Scanner class
9+
10+
int n=sc.nextInt(); //Raeding user input
11+
12+
primeFactorization(n);
13+
}
14+
public static void primeFactorization(int n)
15+
{
16+
/*If n is a factor of 2,we print 2 and
17+
then check whether (n/2)%2 is zero or not*/
18+
while (n%2==0)
19+
{
20+
System.out.print(2+" ");
21+
n=n/2;
22+
}
23+
24+
/*Above loop exits only when n becomes odd,so now n is odd,
25+
so we can skip all the even elements in the for loop i.e i=i+2*/
26+
for (int i=3;i<=Math.sqrt(n);i+=2)
27+
{
28+
/*if i is a factor of n,then print i and then
29+
divide n by i till i is not a factor of i*/
30+
while (n%i==0)
31+
{
32+
System.out.print(i+" ");
33+
n/=i;
34+
}
35+
}
36+
/*condition for the prime numbers
37+
greater than 2,we directly print n*/
38+
if (n>2)
39+
System.out.print(n);
40+
}
41+
42+
43+
}

Java/PrimeFactorization/README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Sample Input:
2+
36
3+
4+
# Sample Output:
5+
2 2 3 3
6+
7+
# Sample Input:
8+
11
9+
10+
# Sample Output:
11+
11
12+
13+
# Explaination:
14+
<h3>TC 1: 2 * 2 * 3 * 3 =36</h3>
15+
<h3>TC 2: 11 , since 11 itself is a prime number and a prime factor of itself.</h3>
16+
17+
<p>The while loop and for loop take care of composite numbers and last condition takes care of prime numbers. To prove that the complete algorithm works, we need to prove that steps 1 and 2 actually take care of composite numbers. This is clear that step 1 takes care of even numbers. And after step 1, all remaining prime factor must be odd (difference of two prime factors must be at least 2), this explains why i is incremented by 2.</p>
18+
19+
20+
# Time Complexity:
21+
<h3>O(sqrt(n))</h3>
22+
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Relevance in Cryptography:
2+
3+
Cryptography is all about number theory, and all integer numbers (except 0 and 1) are made up of primes, so you deal with primes a lot in number theory.
4+
5+
More specifically, some important cryptographic algorithms such as RSA critically depend on the fact that prime factorization of large numbers takes a long time. Basically you have a "public key" consisting of a product of two large primes used to encrypt a message, and a "secret key" consisting of those two primes used to decrypt the message. You can make the public key public, and everyone can use it to encrypt messages to you, but only you know the prime factors and can decrypt the messages. Everyone else would have to factor the number, which takes too long to be practical, given the current state of the art of number theory.
Loading
Loading
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#Read me file to accept bulk linkedin request
2+
3+
steps to accept request:
4+
5+
-open your linkedin account
6+
-In networks section of your account you might have much requests to accept
7+
-To open the Javascript Console in Windows and Linux directly by using the keyboard shortcut CTRL + SHIFT + J
8+
and for macOs you can use COMMAND + OPTION + J
9+
-Type the code in your console and press enter
10+
-The requests will be accpeted
11+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#Javascript Code to run in console to accept the bulk accept requests
2+
3+
var x = document.getElementsByClassName("invitation-card__action-btn artdeco-button artdeco-button--2 artdeco-button--secondary ember-view");//x is request
4+
for(var i=0;i < x.length;i++) //for loop to process each request
5+
{
6+
x[i].click();
7+
}

JavaScript/Counting_Days/Readme.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Script to find no of days left
2+
3+
This script is used to find the number of days left for a particular date.</br>
4+
For example if the target date is 21st Jan 2021 and the present date is 28th Oct 2020, the output will show 84 days left.
5+
6+
1. Open your browser and go to the required webpage.
7+
2. Launch Developer Tools in your Chrome browser
8+
9+
Go to your Chrome , and under the Developer Tools. For Windows / Mac , you can press F12 function key. Alternatively the short cut keys for Windows is “Control + Alt + I”, for Mac it is “Option + Command + I”. If you prefer to use the mouse instead, point to the hamburger menu (the 3 dots) on the Chrome top right corner. Click on it and the Developer Tools is in here
10+
11+
![Developer Tools](https://user-images.githubusercontent.com/56690856/97477999-58b4a080-1976-11eb-8b59-fac7dedb6e88.png)
12+
13+
3. Open console as shown below.
14+
15+
![Console](https://user-images.githubusercontent.com/56690856/97478009-5b16fa80-1976-11eb-8ec8-c179aeb6c833.png)
16+
17+
4. Open the script and change the target date to the required date.
18+
5. Now copy the whole code and paste it into the console section and wait for the script to do its job !!!
19+
![Script](https://user-images.githubusercontent.com/56690856/97478012-5baf9100-1976-11eb-97a6-d447e49b0549.png)

JavaScript/Counting_Days/script.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// get the present time
2+
var presentDate = new Date();
3+
// mention the target time
4+
var targetDate = new Date("Jan 21, 2021 00:00:00");
5+
const oneDay = 24 * 60 * 60 * 1000; // hours*minutes*seconds*milliseconds
6+
// days left
7+
var days = Math.floor(Math.abs(targetDate - presentDate) / oneDay);
8+
console.log("Days Left:" + days);

Python/Admin-Panel/AdminPanel.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import urllib.request as ur
2+
from colorama import init, Fore
3+
4+
init(autoreset=True)
5+
6+
url = input(Fore.BLUE + "\nEnter the website URL: ")
7+
8+
print(Fore.CYAN + "\nSearching...\nThis will take some time. Stay patient!")
9+
10+
# Opening file containing all the suggested admin links to inject
11+
f = open("links.txt")
12+
count = 0
13+
while True:
14+
# Reading individual admin links from the links file
15+
adminLink = f.readline()
16+
if not adminLink:
17+
break
18+
print(adminLink, end="\r")
19+
completeUrl = url + adminLink
20+
try:
21+
# Opening the URL with admin Link
22+
search = ur.urlopen(completeUrl)
23+
print(Fore.GREEN + f"\nAdmin Panel found at {completeUrl}")
24+
count = count + 1
25+
break
26+
except:
27+
continue
28+
29+
# If none of the suggested admin links were correct
30+
if not count:
31+
print(Fore.RED + f"\nCouldn't find any Admin Panel!")

Python/Admin-Panel/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Description
2+
3+
A Python Script to find admin panel of a website
4+
5+
## How to execute this Script
6+
7+
+ Run `pip install -r requirements.txt` to install the required packages.
8+
+ Run the script using `python3 AdminPanel.py`
9+
10+
## Example
11+
12+
![AdminPanel](images/adminPanel.png)
22.3 KB
Loading

0 commit comments

Comments
 (0)