littlelogs

Keep a social journal of your work progress as you make and learn things.

#bash

February 2016

loudmouthman
loudmouthman

#bash

I probably get around to using this one liner more than a few times in a month; Im usually needing to discover which IP address is abusing my log files the most

cat access_targetphrase.log  | awk {'print $1'} | sort | uniq -c | sort -n | tail -n10

This always reminds me that

1) Awk is superpowerful and constantly underused 2) Windows Log files are not nearly as easy to throw around as Unix ones. 3) I like making numbered lists.

January 2016

loudmouthman
loudmouthman

#AWS #PHP #BASH
Its not event 10:20 and this morning i have edited a legacy php system to include an extra column of data which apparently has never appeared on a export and has only just been discovered. Ive recovered a lost xls file for a client because they are sloppy clickers and had dragged it to another share. I have configured a jailed user account with their own secure key and access to a folder on the filesystem so they can upload files directly. I have checked in on a STEM event I am helping deliver this evening and I have not even had my second cup of coffee.

loudmouthman
loudmouthman

#AWS #Cloudwatch #Bash ; For those interested in the relevant AWS command line content the link is included. Things I discovered is that you need to ensue that your source machine running the instance requests runs ntpdate to ensure its internal clock is consistently uptodate. I had too many problems with the times otherwise. I have another script on the remote EC2 webinstance which can pick up the logs and look over an hour of content and return the lines and bytes requested. all Written to csv for now.

loudmouthman
loudmouthman

#AWS #BASH , and it is working … now to leave it a few hours and see if its correct. The collection of basic Cloudwatch metrics for a number of instances in addition to which a script which gathers the count of lines in the log file and the sum of bytes requested for that instance. I am hoping that the Loadbalancer requests will be far less than the Apache Log Lines which then informs me of the value of my varnish caches. I may also grab some varnish cache stats.

loudmouthman
loudmouthman

#AWS #bash nothing like a good distraction and today it was getting AWS Command line working so that I could get the metrics for our instances and report back every hour.Sure here are other services that offer this but I dont want to add more external pressure to an internal routine. this way reduces the amount of open things into the backend. more to post on this later once I have it wrapped and operational

loudmouthman
loudmouthman

Installing Ruby on Raspberry Pi so that I can install wpscan on Raspberry Pi so I can set up … actually you know what I might just make a Pi Cluster for the hell of it. But thats another day. Anyway ; go ahead with the basics …

apt-get install ruby-dev screen

then go ahead and run screen and fetch the following Ruby Install Bash Script

All sorted. great then grab the git
git clone https://github.com/wpscanteam/wpscan.git

and change into the wpscan folder ; nearly there .. then run up the gem bundling fun over on

sudo gem install bundler && bundle install –without test development

Then be patient again … Im noodling on the idea of Raspberry Pi scanners for dev sites

More on running wpscan in other logs.

#ruby #bash #wpscan

loudmouthman
loudmouthman

#bash ; you know how sometimes you inherit a script and it just works and then you go away and you are happy to see that. Well then you come back and you realise that the script wasnt working. In this case a process to restart inotify was frankly crap and not working the way I wished it to. I’ll post the script into paste.bin but the key element were these lines. Granted I could use xargs but that assumes that inotifywait is running further I add the qualifier of the run time path otherwise you end up with two processes one of which is the grep command.

psid=$(/bin/ps aux | /bin/grep -i inotifywait | /bin/grep -e "usr/bin"  | /usr/bin/awk {'print $2'} )
   if [[ $psid > 0 ]]; then
        /bin/kill $psid
   fi

The pastebin for this is : http://pastebin.com/KzrRmppP

nathanieloffer
nathanieloffer

Well I’ve spent more hours than I’d like to admit trying to create a bash alias that contained a variable. Basically I’m trying to pass a url to the command line from the clipboard alias ytd="youtube-dl $(xclip -o -selection CLIPBOARD)" To only now find out alias’ can’t contain variables & I should have been writing a function all along. I really understand Edison at times like this “I have not failed, I’ve just found 10,000 ways that didn’t work” #bash #cli