This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/usr/bin/python | |
import servicemanager | |
import win32serviceutil | |
import win32service | |
import win32api | |
# define the action to do when we get signals | |
class Service(win32serviceutil.ServiceFramework): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
void showbits(int number) { | |
// logic for One's complement | |
int i, k, andmask; | |
// 16 bit representation | |
for(i = 15; i >= 0; i--) { | |
andmask = 1 << i; | |
k = andmask & number; | |
// ternary evaluation |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
// getting the binary representation - 16 bit format | |
void showbits(int number) { | |
int i, k, andmask; | |
for(i = 15; i >= 0; i--) { | |
andmask = 1 << i; | |
k = andmask & number; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
// getting the binary representation - 16 bit format | |
void showbits(int number) { | |
int i, k, andmask; | |
for(i = 15; i >= 0; i--) { | |
andmask = 1 << i; | |
k = andmask & number; | |
k == 0? printf("0") : printf("1"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
int main() { | |
// starting value | |
int data = 65; | |
// using the AND operator | |
int result = data & 32; // internally performs a binary comparison for the 5th bit (log 32 is 5) | |
// data evaluation | |
if(result == 0) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
int main() { | |
int b = 50; | |
b = b ^ 12; | |
printf("XOR Output is %d \n", b); | |
b = b ^ 12; | |
printf("XOR Output is %d \n", b); | |
return 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
import socket | |
import os | |
import sys # handling CLI args | |
def get_banner(ip, port): | |
try: | |
socket.setdefaulttimeout(2) | |
s = socket.socket() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
# performing hashing | |
import hashlib | |
hashvalue = input("[+] Enter a string to hash: ") | |
# hashing md5 | |
hashobj = hashlib.md5() | |
hashobj.update(hashvalue.encode()) | |
print(hashobj.hexdigest()) # printing data |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
from urllib.request import urlopen | |
from termcolor import colored | |
import hashlib | |
# input - sha1 hash | |
hash = input("[+] Enter sha1 hash value: ") | |
# converting the request into a string | |
plist = str(urlopen("https://raw.githubusercontent.com/danielmiessler/SecLists/master/Passwords/Common-Credentials/10-million-password-list-top-10000.txt").read(), 'utf-8') |