Jul 02 2010

remove stale locks vmware server 2

Category: documentation, quick hacksben @ 4:32 pm

so my virtual machine server went down in my office the other day, and the auto startup for a specific machine failed because there was a lock file present from before the power failure (time to replace my ups)

it was easy enough to fix by removing the folder located at:

/var/lib/vmware/Virtual\ Machines/{vm-name}/{vm-disk-file-name}.vmdk.lock/

for me the command was:

# rm -vfr /var/lib/vmware/Virtual\ Machines/nataile/natalie-hardDisk1.vmdk.lock/


Jul 01 2010

reparse and remount fstab

Category: documentation, quick hacksben @ 7:52 pm

after adding a  usb drive to fstab i reloaded it and remounted when needed using the following command:

# mount - a -o remount


Jun 10 2010

unpack multiple files at once using xargs

Category: documentation, quick hacks, scriptsben @ 12:55 pm

how to upack all tarball gunzips .tar.gz in a given directory at a time

ls *.tar.gz | xargs -t -I {} tar -zxvf  {}

*note: after the -t it is a -I as in -(capital)i

substitute your flavors at -zxvf and adjust file list at the ls command before the pipe


Mar 20 2010

compiling from source against 2.6.33

Category: documentation, quick hacksben @ 3:36 pm

i screwed up my slackware install on my laptop, did a reinstall, realized i installed 32-bit and decided to roll with it. everything i have gone to install out of the official tree has needed some patching due to the new kernel.

apparently the new kernel (2.6.33) no longer generates a file named /usr/src/`uname -r`/linux/autoconf.h and instead generates one named /usr/src/`uname -r`/generated/autoconf.h –> what this means to compiling from source is that all references to the linux/autoconf.h must be redirected to generated/autoconf.h

trust me that this is a major headache that isn’t very well documented yet


Mar 10 2010

remove files by date - bash

Category: documentation, quick hacks, scriptsben @ 5:14 pm

find /path/to/files/* -mtime +5 -exec rm {} \;

where +5=older than 5 days


Oct 25 2009

wep cracking with aircrack-ng

Category: documentation, hardware, quick hacks, scriptsben @ 8:58 pm

had to get a new usb adapter that was capable of inject and monitor modes. took a chance with a netgear usb wg111 at best buy, it happened to be ralink based (wg111v3). then i installed the aircrack-ng suite and began testing my network with the commands below

scan for available networks using card that can do injection
# iwlist wlan0 scan
start airmon-ng on the appropriate channel and interface
# airmon-ng start wlan0 6
do an injection test for good measure
# aireplay-ng -9 wlan0
do an injection test against target network
# aireplay-ng -9 -e {ssid here} -a {mac of ap here} wlan0
start the airodump *needs dedicated terminal or backgrounding of process
# airodump-ng -c 6 –bssid {mac of ap here} -w output wlan0
begin probe *needs dedicated terminal or backgrounding of process
# aireplay-ng -1 6 -e {essid here} -a {mac of ap here} -h {mac of associated client or own mac} wlan0
begin injection *needs dedicated terminal or backgrounding of process
# aireplay-ng -3 -b {mac of ap here} -h {mac of associated client or own mac} wlan0
begin cracking *needs dedicated terminal or backgrounding of process
# aircrack-ng -z -b {mac of ap here} output*.cap

just let those things run until it gives you the key

moral of the story: never use WEP


Jul 17 2009

klogd it

Category: documentation, inspiration & quotes, moods, quick hacksben @ 2:34 pm

step one: ln -s /dev/null /thetoilet

step two: klogd > /thetoilet  2>&1

this is how you can clog the toilet with 2s and 1s


Jul 14 2009

remove files and folders by date

Category: documentation, quick hacks, scriptsben @ 8:00 pm

this is designed to delete files by date from the current directory….it was googles fault for providing “source” in a .deb with relative paths without being clear. plus it was my fault for not doing a test extract prior to doing a real one….pretty irrelevant but was needed to tidy up my /usr/local/src

by design will remove files dated 2008-11-07 from slackware’s ls -al …probably would be wise to trial run it by changing the xargs to an echo first ;-)

#ls -altrh |grep ‘2008-11-07′ |awk {’print $8′} |xargs rm -rfv


Jun 11 2009

phpMyProxy - Simple, Straightforward and works

Category: documentation, helpful links, quick hacks, scriptsadmin @ 1:15 pm

When a routing issue in our datacenter arose today, as a temporary solution i whipped out a proxy install that was so basic i couldn’t mess it up (and i definitely was doing “unsupported” tweaks to the files). To embelish on the routing issue a little more: a local isp moved some equippment into the datacenter, now on the same level in the same pool as our servers, their clients could not reach our servers when entering the routes from very specific directions. a temp solution is now in place and they aren’t sure when the permanent solution will work…don’t blame me….nothing changed on my end.

http://www.drunkensailor.org/proxy/

www.phpmyproxy.com - i did have to register for the initial link, but since it’s open source here’s a link to my version’s tarball…(so much lighter!!!)


May 28 2009

ndiswrapper with linux kernel 2.6.29.2

Category: documentation, hardware, helpful links, quick hacksadmin @ 12:14 am

made the all too fatal yet all to common mistake of updating to slackware current fully and lost the ability to compile some of my favorite (virtualbox) and most used (ndiswrapper) software due too stricter code residing in the kernel. so all that aside, i HAVE to use ndiswrapper with mylow power lp-phy usb-like mini pci card…it sucks in short.

so with ndiswrapper not compiling i was giving up hope until i found this post –> read through to the last post by slh.. in it he shows a patch fix (which is pretty striaght forward to apply manually) and i have included below:

fix C syntax error and field name in conditional netdev ops struct,
triggering on kernel >= 2.6.29 and CONFIG_NET_POLL_CONTROLLER=y.

— a/driver/wrapndis.c
+++ b/driver/wrapndis.c
@@ -1744,7 +1744,7 @@ static const struct net_device_ops ndis_
.ndo_set_mac_address = ndis_set_mac_address,
.ndo_get_stats = ndis_get_stats,
#ifdef CONFIG_NET_POLL_CONTROLLER
- .poll_controller = ndis_poll_controller;
+ .ndo_poll_controller = ndis_poll_controller,
#endif
};
#endif


Apr 16 2009

block google analytics

Category: documentation, quick hacksadmin @ 4:41 pm

host file entries made for:
127.0.0.1       www.google-analytics.com google-analytics.com ssl.google-analytics.com analytics.google.com googleanalytics.com

how can it be tracking at this point?


Apr 16 2009

enable ssh on esxi

Category: documentation, quick hacksadmin @ 3:04 pm

1. on your ESXi host console press ALT+F1.

2. type “unsupported” (not including quotes)

3. enter your root password

4. edit /etc/inetd.conf (vi /etc/inetd.conf) find the line with ssh and uncomment it. save the file

5. do ps auxw | grep inetd to find inetd’s PID and send it a HUP signal


Apr 16 2009

bypassing netfirms block on rsync

Category: documentation, quick hacksadmin @ 2:26 pm

alright so netfirms blocks rsync, right? well even if you didn’t know, it’s true. So my backup methods have been less than desireable while i spend time brainstorming the real answer.

today i found it.

I’ve played around with sshfs before and the solution was inherent in this new toolset.

netfirms gives ssh access (to accounts that pay for it)

all things being what they are heres what i did:

1. install sshfs on backup server

2. sshfs mount my www root on netfirms to my backup server to a local mountpoint

# sshfs username@domain.com:/path/to/www/ /mnt/sshfs

3. begin the rsync to a local folder

# rsync -azevvv /mnt/sshfs /local/backup/

4. fire it off and go get a 12 pack and maybe more if your hosting dir is large with lots of domains

5. once it has done, unmount the appropriate shit and find a way to script it.

# umount /mnt/sshfs

6. Yay! now you have an active rsync method for netfirms…why did they have to make it so difficult!