Occasionally I type a password or other sensitive information into a shell prompt. Using bash history, the command can be removed.
# say we start with an empty bash command history
bash-3.2$ history
1 history
# enter a command that requires a password
bash-3.2$ sudo rm -i some_file
Password:
# accidentally ^C and type your password
# into the prompt and hit enter
bash-3.2$ secret_password
bash: secret_password: command not found
# your password is now there for all to
# see in your bash history
bash-3.2$ history
1 history
2 sudo rm -i some_file
3 secret_password
4 history
# first option to fix it, delete the numbered entry from
# history and write to your ~/.bash_history file
bash-3.2$ history -d 3
bash-3.2$ history -w
# entry 3 will be removed entirely from your command history
bash-3.2$ history
1 history
2 sudo rm -i some_file
3 history
4 history -d 3
5 history -w
6 history
# the second option is to clear the entire history
# and write the changes to disk
bash-3.2$ history -c
bash-3.2$ history -w
# it's now pretty obvious that your history has been
# scrubbed clean, but at least your password is history!
bash-3.2$ history
1 history -w
2 history
I have tons of PDFs in multiple sub-folders in /home/user/original that I have compressed using ghostscriptpdfwrite in /home/user/compressed.
ghostscript has done a great job at compressing about 90% of the files however the rest of them ended up bigger than originals.
I would like to cp/home/user/compressed to /home/user/original overwriting files that are only smaller than the ones in destination while the bigger ones are skipped.
I need to create a shell script that appends a timestamp to existing file. I mainly use Mac OS X for development. Wanted to create the same on Mac Terminal.
Here are some basics on date command.
NAME
date -- display or set date and time
SYNOPSIS date [-ju] [-r seconds] [-v [+|-]val[ymwdHMS]] ... [+output_fmt] date [-jnu] [[[mm]dd]HH]MM[[cc]yy][.ss] date [-jnu] -f input_fmt new_date [+output_fmt] date [-d dst] [-t minutes_west]
Samples:
bash-3.2$ date Wed Sep 26 19:29:10 PDT 2012 bash-3.2$ date +"%Y/%m/%d" 2012/09/26
Script to append date stamp to file:
#!/bin/sh file_name=test_files.txt
current_time=$(date "+%Y.%m.%d-%H.%M.%S") echo "Current Time : $current_time"
new_fileName=$file_name.$current_time echo "New FileName: " "$new_fileName"
cp $file_name $new_fileName echo "You should see new file generated with timestamp on it.."
Recently we wrote about ApacheKiller that freezes Victim Server in seconds. While this new findings by IHTeam express that Google+ Servers can be use for DDoS attack. Lets talk about this ant script, Hey.. but it is worthy.
How DDoS Attack Using Google+ Servers works?
When you post a URL on your Google+ status it fetches URL Summary (It includes Image + Short description) using Google+ Proxy Servers.
Advisory report says; vulnerable pages are “/_/sharebox/linkpreview/“ and “gadgets/proxy?“
So if you send multiple parallel requests with a big number e.g 1000 that can be turn into DDoS attack using Google+ Servers huge bandwidth.
How to use DDoS script to launch a DDoS attack Using Google+ Servers?
NOTE : Make sure your workstation is capable to handle this huge number else your workstation will freeze and you will have to force fully restart your own workstation ?
e.g 1000 is very big number.
You will see anonymous source instead of Real Source IP: See sample apache webserver log below