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 requests | |
from threading import Thread | |
import sys | |
import time | |
import getopt | |
from requests.auth import HTTPDigestAuth | |
global hit |
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 socks | |
import socket | |
from urllib.request import urlopen | |
if __name__ == "__main__": | |
# defining the SOCKS proxy and the host | |
socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, "localhost", 9050) | |
# performing an request |
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 | |
''' | |
The counterpart is done by: ncat --ssl -vlp 8888 | |
''' | |
import os | |
import socket | |
import ssl # for socket wrapper |
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
[Unit] | |
Description=Daemon for creating a txt file in a specified user | |
After=network.target | |
[Service] | |
User=root | |
ExecStart=/home/david/service_folder/file_creation.sh | |
[Install] | |
Wantedby=multi-user.target |
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
#!/bin/bash | |
# dialog box -> ability to created text-based menus, inputs, textbox -> more graphical | |
# apt install dialog | |
# global / default values | |
INFOBOX=${INFOBOX=dialog} | |
TITLE="Default title" | |
MESSAGE="Something to say" | |
XCOORD=10 |
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
#!/bin/bash | |
# shell expansion -> ability to use shortcuts to manage ouputs | |
echo sh{ot,ort,oot} # print out a list | |
echo st{il, al}l | |
# getting the HOME directory | |
echo ~ |
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
#!/bin/bash | |
# traps (look for the ocurrence of something - event, commands, signals -> redirect reaction) and signals | |
clear | |
# what to do, what is it we are traping | |
trap 'echo " - Please Press Q to Exit ..."' SIGINT SIGTERM SIGTSTP # interrupt or simple kill | |
while [ "$CHOICE" != "Q" ] && [ "$CHOICE" != "q" ]; do |
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
#!/bin/bash | |
# doing some simple substitution using `` | |
TODAYSDATE=`date` | |
USERFILES=`find . -user david` | |
echo "Today's Date: $TODAYSDATE" | |
echo "All files by USER: $USERFILES" |
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
#!/bin/bash | |
# file descriptors - is a numeric representation of a file to read-write to it - determine how to open it at runtime | |
# the number should be >= 3 because 0,1 and 2 are reserved by the OS to stdout, stdin and stderr respectively | |
echo "Enter a file" | |
read FILE # file variable | |
echo "The file is: $FILE" | |
# referring to the stream in (read&write mode = <>) | |
exec 5<>$FILE |
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
#!/bin/bash | |
# handling EXIT command | |
trap 'exitProc' EXIT | |
exitProc() { | |
echo "Exit instruction intercepted" | |
echo "Cleaning files" | |
rm -rf first.txt second.txt | |
exit 1000 |