Encrypting and Compiling BASH code

Standard

If you are looking to protect your BASH script from prying eyes, try encrypting it and then compiling it.

1st: Encrypting
1] obfsh – You will want this tool from http://www.comp.eonworks.com/scripts/obfuscate_shell_script-20011012.html
obfsh is quite flexible and can obfuscate any type of shell script. The
obfuscated script version is printed to stdo. The original script is not
modified.

Using obfsh options cleverly, one may fool more then just a casual intruder
or snooper, and certainly make understanding of the obfuscated script harder
and more time consuming.

Read some of the options first.

You can vary the way it works.

So to encrypt it, take this tool and make your script hard to read.

2] ?(Another method is out there. Just have to find it again.)

2nd: Compile
Take your newly encrypted file from step 1 and use it here with the tool called shc.

Check your distro or goto http://www.datsi.fi.upm.es/~frosal/ and download shc (shc-3.8.9.tgz version of this posting).
Edit: After trying to get this to work smoothly, and failing to get “make” to work, I then tested version 3.8.7. This one ran “make” correctly and “make install”. I suggest using it instead. http://www.datsi.fi.upm.es/~frosal/sources/shc-3.8.7.tgz

Use -r, this will relax security to create a redistributable binary that executes on other systems that runs the same operating system as the one on which it was compiled.

3rd (optional): Specifying Expiration Date for Your Shell Script
This makes it so the compiled bash script will not run after the set date and will display a message instead.

Note:
If you get the following error messages upon give the shc command:

then install the following packages:

Last but not the least. There is no guarantee that this utility will provide you a very strong security protection. Experienced users or hackers who have sufficient knowledge about “gdb” or other debugger tools can decrypt your shell script(when using shc alone). Although it does provide a good starting point to encrypt (hide) shell scripts from “regular” users if you are a system administrator.

4,088 total views, no views today

Seth Leedy’s GRC Security Now Podcast Download Script

Standard

Security Now Logo

This script is a work by Webmaster Seth Leedy, but was inspired by and evolved from the scripts by Thomas@devtactix.com


I noticed that I was mentioned in the Security Now show(epi: 457, 558). Yipee!


Download any or all Steve Gibson’s GRC Security Now podcasts via a bash script.
The script can look at the episodes already downloaded and download the next one.
You can specify the episode(s). Download 1 or a range.
Another function is to search for text within ALL the episodes and copy the episode text to another directory for further reading.
Run it with “-h” for all the other options.


The code is now on GitHub ! Feel free to help develop it or fork it.

You can submit issues within GitHub or via email to me. Comments below are not actively monitored…


Todo:

  • Allow for different cases on the “.mp3” searches. Only looking at lower case right now.
  • For version 1.8, allow perhaps, a different source for the files in the RSS Feed. Instead of GRC and CacheFly.

Examples:

  • Will download the latest episode and it will be the TEXT transcriptions.
    • ./GRC-Downloader.sh -eptxt -latest
  • Will download the latest episode and it will be the PDF transcriptions.
    • ./GRC-Downloader.sh -eppdf -latest
  • This will download the TEXT and .PDF.
    • ./GRC-Downloader.sh -eppdf -eptxt -latest
  •  The arguments -ahq and -alq is for downloading AUDIO .MP3 files.
    • -AHQ = High Quality. -ALQ = Low Quality.
  • The arguments -vhq and -vlq is for downloading VIDEO .MP4 files.
    • -VHQ = High Quality. -VLQ = Low Quality.
    • ./GRC-Downloader.sh -alq -vlq -eptxt -latest
      or
    • ./GRC-Downloader.sh -vlq -eptxt -ep 10
  • You can also download all video, in HD, and text- at once. At 10 downloads a time. *Not all episodes are in HD. The start of the show was not in video nor HD.
    • ./GRC-Downloader.sh -vhd -eptxt -ep 1:latest -pd 10
  • Will download every single text copy of the episodes and search for your text( TNO here ) and put the results in a special directory for you to open at your leisure.
    • ./GRC-Downloader.sh -dandstxt TNO
  • Will search only the text episodes already downloaded in the current directory and the cache used in the above -dandstxt option. It will not go online to search.
    • ./GRC-Downloader.sh -stxt TNO

Count of script executions:

  • Agent: GRCDownloader_v0.8, Count: 2
  • Agent: GRCDownloader_v0.9, Count: 11
  • Agent: GRCDownloader_v1.0, Count: 14
  • Agent: GRCDownloader_v1.1, Count: 1
  • Agent: GRCDownloader_v1.2, Count: 2
  • Agent: GRCDownloader_v1.3, Count: 138
  • Agent: GRCDownloader_v1.4, Count: 46
  • Agent: GRCDownloader_v1.5, Count: 116
  • Agent: GRCDownloader_v1.6, Count: 965
  • Agent: GRCDownloader_v1.7, Count: 806
  • Agent: GRCDownloader_v1.8, Count: 1318

11,146 total views, no views today

BASH script based Matrix effect. Use it in .screenrc

Standard
BASH Matrix effects
BASH Matrix effects
matrix (1).tar.gz
1.1 KiB
310 Downloads
Details...

The paths are needing adjusted to work for your placement.
Two places to change. Number one is the matrix.sh file. You will see it below.
Number two is the matrix_char.sh file. The very first part.
Continue reading

731 total views, 1 views today

GRC Security Now Podcast Download Scripts

Standard

There seem to be two that would work for you.

See my own(Seth Leedy’s) script for downloading GRC Security Now Podcasts!


A Windows script, and a BASH script which could be run on both Windows or L/Unix.
wget for windows, here.
BASH for Windows, here.

Copied from the g.securitynow newsgroup hosted on news.grc.com on date 2012-05-12 07:51 AM.
First message. Subject: “Little SN download script”

As it states, he was publishing a script to download all Security Now episodes from the server.
This spawned a few messages of how to do it differently.
I am attempting to record all these different ways for future downloaders.
If you attempt this, set aside some space. As of 2012-05-16, approx: 11.8GB for HQ, 3.62GB for LQ.

James Womack:


Thomas:
Hi James,

I also make use of scripting to maintain my SN-archive. Attached you will find the ones I made. Their function is very simple and as a default (void of argument) will “guesstimate”, i.e. make use of previously downloaded stuff and then based upon that derive “next” episode for download.

Big note: As you, I wrote these in a bit of a haste a few years back and I had absolutely no intention of the code being scrutinized by this community or anyone else for that matter. If you find the code yucky, or beyond, most likely I am already agreeing. If you see solutions in the code that could have been written a lot more clever, again it comes as no surprise at all.

Disclaimer: These scripts are not guaranteed to be failsafe, foolproof or even to work…but to my experience they usually do, at least in line with my initial description. These scripts are definitely not compatible with the intentions of the RIAA, MPAA or any other racketeering organization affiliated with Sony and the other legitimate crooks of our time and society. Then again, anything able to download whatever or for that matter technology in general beyond the abacus is probably incompatible along those lines…
dl_sn_grc.sh:

dl_sn.sh:


Now gdb says to use this

and it spawned a large response thread.

Guy says:
Thanks for the information.
I use Windows – so curl is the tool for the task of topic.

Mark Cross adds:
Adding -N check timestamp and wont download existing files (if they haven’t changed) and -c to continue existing downloads:
echo wget -Nc http://media.grc.com/sn/sn-${padding:${#i}}$i.mp3

Update:
A real ‘one liner bash command’ needs some artistic tweaking (for bash 3.1):
a=’printf %03d’ eval “wget -Nc http://media.grc.com/sn/sn-{$($a 1)..$($a 25)}.mp3”

or (won’t mess with the environment vars set on present shell, for bash 3.1):
sh $(beg=1;end=25;a=’printf %03d’;eval “wget -Nc http://media.grc.com/sn/sn-{$($a $beg)..$($a $end)}.mp3”)

and (for bash 4):
sh $(beg=001;end=025;eval “wget -Nc http://media.grc.com/sn/sn-{$beg..$end}.mp3”)

maybe a bit too complex ;)


ObiWan says something interesting for Windows:


ObiWan also came up with this and I think, right now anyways, this would be the best way to do it for Windows users:

The below will fetch all the episode from 001 to 100 (for…) and save
then in c:\sn the episode number is correctly aligned with zeroes by
that “%NBR:~-3%”; basically the code first adds 000 in front of the
number and then picks the rightmost 3 chars


9,618 total views, 1 views today