31
Filed Under (Life) by Gert on 31-05-2007
Finally got the Genbook & other related stuff up again. smeggin provider
Smeg
About the fuck time
31
Finally got the Genbook & other related stuff up again. smeggin provider
Smeg
About the fuck time
30
I already knew that in linux it all comes down to resourcefulness.. Once again its been proven. You can do anything you want with the proper combination of basic commands!
I was tired of depending on dyndns, especially since I have an own URL. Problem was, how to get my external IP adress. The first commands I thought about were traceroute / ifconfig / ping / .. but, I soon realized this wouldnt work. A lot of data but just not what I needed
So I googled it & it came up with a ‘lynx -dump “http://checkip.dyndns.org”‘ style command. This sounded a bit bloated to me, but I gave it a try. didnt turn up too much. Another person used “html2text” & .. I didnt even try that one. Those just arent the standard commands.. Well, they are, but they do A LOT MORE!
So whats the solution? “wget”!
So far so good.. “wget url”.. but thats still relying on dyndns. And I Didnt want that. Now, I use a standard D-Link router. This router has a device info page which contains the external address. This is accurate.
So we ‘ve got the data, but A LOT of data. Too much
& we ‘ve got grep for that. So lets craft ourselves a grep command!
The external IP is on a line on its own. 3 lines above it, there ’s the word “Address” so we’ll do a “grep Address FILE -A 5″ (-A 5 to get the 5 trailing lines)
Now we have 4 of those occurrences. We only need the IP addresses, so we ll pipe that output to “grep -E [0-9]+\.[0-9]+\.[0-9]+\.[0-9]\+ “
This gives us 2 addresses, an internal one for the router himself (yeah, its a bitch) and the valuable external one! Now lets separate these
We dont know anything about the later, but we obviously know the first.. So another quick grep here.. “grep -v 192.168.0.” so we dont see any internal addresses.
All this put together gives us the following
wget -q –user username –password password http://192.168.0.1/st_device.html
grep Address st_device.html -A 5 | grep -oE [0-9]+\.[0-9]+\.[0-9]+\.[0-9]+ | grep -v 192.168.0.
rm -f st_device.html*
This outputs the external IP to the command line, ready to upload with ftp or do whatever the fuck with it
I’ll probably “grep … > file” and “ncftpput -u User -p Password -r2 -t600 -DD -m Server URL SourceFile” & maybe even throw in a “diff” to determine if the ip address is different than the former. We might keep it in a file or download it from the place we re uploading it to.
And No worries about uploading a wrong one since we re uploading over the same router we re asking the info to. If he cant provide it, he cant upload either.
Now throw this in a cron & no more need for dyndns
Provided the space we re uploading it to stays up, ofcource..
You might also want to throw in some checks, for example, if the file isnt downloaded or empty, dont bother running the rest. Dont squander the processing time (if only by principle) & most of all, dont risk uploading an empty file over your ip adress in the file
(if for example the router reboots during wget but is up & running again by the time the ftp kicks in)
Something to consider here tough, is security. We re doing rm -f, downloading pages, executing crap, .. putting this in a cron, uploading over cleartext, whatnot. This, however, is beyond the scope of my blog post
Go read a book or whatever!
Interesting process to observe while solving problems like this.. its quite simple actually
1. Ask yourself.. what information do you you Want?
2. Locate that information. independent of where it is or how to get to it. Thats for later
3. Determine how the information is served (this is a crucial step, it sounds dumb, but it is!)
4. now locate a linux commandline client for that protocol. There are more than you can imagine. pdf2txt, wget, ftp, …….
5. script it together. once you ve got the data, its simple to reformat it. Only a matter of time
This DOES obviously sound cheap.. but did YOU immediatly think about the smegging wget to the DLink? I know I didnt. Because I immediately thought that information was not easy to come by. I thought of telnet client stuff or whatever.. but.. forgot that its simply there in the web interface!
Follow the steps & carefully consider before writing off a source in the second step.
Edit.. for those too lazy to write the necesary code.. all you have to do here is edit the variables!
# Variables
## Location & filename for temporary files
map=”/tmp/”
file=”IpFile”## Remote Webserver settings
server=foo.bar
serverU=foo
serverP=bar
serverMAP=/public_html/foo/bar/## Webpage with IP info page
IPpage=http://acme/ip.html
IPu=foo
IPp=bar## IP base to ignore – to filter out local IPs
IPbase=10.0.0.## Do not edit beyond this point
![]()
if [[ $map == "" || $map == "/" || $file == "" ]]
then
echo “Thank god I didnt trust you to fill these in wisely.”
echo ” (dont get over confident tough, this is an EXTREMELY basic test!!)”
echo “At least One of the following errors was found!”
echo
echo “* the map and file variable can NOT be empty!”
echo “* the map can NOT be / (the root).”
echo “Since we re doing rm -f, these settings might cost you your OS!”
echo ””
echo
echo $map$file
exit 1
fi# make sure there s no files that could screw the process
![]()
rm $map$file* -f# Get IP
wget -q –user $IPu –password $IPp $IPpage -O $map$file.router# check for file existance
if [[ -e $map$file.router ]]
then
grep Address $map$file.router -A 5 | grep -oE [0-9]+\.[0-9]+\.[0-9]+\.[0-9]\+ | grep -v $IPbase > $map$file# Get curent file
ncftpget -cV -u $serverU -p $serverP $server $serverMAP$file > $map$file.Oif [[ ! -z $( diff -q $map$file $map$file.O ) ]]
then
# Upload file
ncftpput -V -u $serverU -p $serverP -r2 -t600 -DD -m $server $serverMAP $map$file
fifi
# remove residual files
rm $map$file* -f
asfor WHY I took the time to do this? because I needed this script myself
I just realised.. ncftp is a great ftp program but not really standard. You can replace this by vanilla ftp tough you ll have to figure out those commands on yer own..
The rest is pure vanilla linux soft (grep & wget)
This piece of shit windows screwed up my media player by installing the mediaplayer update. Now I get some nonsense error. Crap Software! aaaaaaaargh
Im installing linux tomorrow! Actually probably not tomorrow, but one of these days, alice.. one of these days! Pow! Right in the kisser!! Bang, zoom, straight to the moon!
edit: uninstalling worked. At least they seem to be able to REMOVE their crap decently. although I’ll never know what amounts of crap this left behind. At least I can use mediaplayer agan!
29
a lousy day
Even sopranos skipped a beat
29
29
Im finally getting to watching it.. 7.6 on imdb.. I’m Curious
26min.. So far so good
I was supposed to work al week.. most of it got canceled (5 out of 6 days) I’m not entirely happy about that. Tough I do like the fact that this buys me more time to work for school..
The whole mob thing.. Amazing
Im looking forward to GTA IV. Rusian Mob.. Yeah
A pitty, the amount of upgrades this ll ask of my PC. Another pitty.. Ill have to wait for it to come out on PC & those sony bastards.. it ll take a while to happen
Im still wondering if we ll ever get to play the “.. stories” games (VC stories, SA stories, ..) altough I dont really care about those. PSP quality.. Still loving the whole Vice City game
Lefty .. what an amazingly Rich character.. damn. only Pachino
& Sonny Black.. Michael Madsen is Amazing! Incredible
& Donnie himself ofcourse. Depp is a powerfull actor.
Great cast, but you dont get a 7 in imdb easily
59min Wiseguy Tennis.. Supa
I might go out & get me the Godfather box tomorrow
Anyone who hasnt said the words by now can crawl into a hole & decompose for all I care (with maybe One exception) Those who cant handle this shouldnt be reading this. There s lots of other sites on the web. Try one of these.. (one, two, three!) There s no roster this time. Noone could be bothered to wait for the day. The Hut REALLY screwed things up for me this year. Its a pitty. 25 is a number to remember. And I will.. 26 will be better!
My busy work schedule did have its costs. I really want to pass this annoying school year, I really want to FINALLY be rid of school! But by god, if Id have known the cost.. I d probably have gone into it differently. Or maybe plainly just not at all. I mean, I dont really value the rubbish they thought me. & I still believe that I d have made it without all those useless years. I got to deploy myself in ways i d probably wouldnt have had the time for otherwise. And those are rich experiences. But its not what school taught me. Its what utterly ignoring school enabled me to achieve. Asfor my internship.. I can honestly say that the ONLY appliance of my X year education was the fact that they told me about wireshark. And I would have figured that out by my own too! I realize (again the s-z problem – amazing) now even more that the rubbish they value so high is Actually worth Nothing more than I supposedly ignorantly suspected.
As expected today was utter shite. I actually started the day by walking into dog excrement. (yeah, shite for those that dont understand)
Oh & I also found out why I can barely find anyone to play games with me anymore.. I tought they just didnt enjoy it as much as I do.. As it appears, I was wrong! How naive.
I should go to sleep but I wont like the day I wake up to, so Im putting it off. One heap of excrement, I tells ya!
I wanted to buy the latest gloomcookie (Thats 5) yesterday, but the guy didnt know the exact price, so I couldnt. Utterly depressing So I got 3 episodes (apparently thats all of them) of Nightmares & Fairy Tales. They re all by Serena Valentino & the good people at Slave Labor Graphics (SLG)
Plus some other commics. A dragon ball & 2 Dufaux et Marini commics L’Etoile du Désert (lol, I just discovered they got Rapaces translated in english. They re called Raptors. funny. & good too, they deserve it. They should to the scorpion too. That one s even BETER) and 3 dvds while we re making the list & checking it twice.. Sin City, Donnie Brasco (can you believe I havent seen this movie!!) & Aeon Flux (I REALLY need to get me them series DVDs from Amazon!!)
Battlestar Galactica looks promising & Im extremely happy to have GTA Vice City to play. Its SUCH a good game.. Amazing!
Im off to bed
Mini already pointed out I am staying up waay beyond what I originally planned. pf. I just dont feel like tomorrow!
ah & tonight will be the first night of No Muscle Relaxants! I hope Im not cripled in the morning!! I look forward to a pure night of sleep tough
.. things will get better! Only 3 more weeks, 5 more weeks & 4 months.. Ive been saying this for the last 2 years, only 4 more months
No time to get burnt out, thats for sure!
Oh & the bitches at my provider didnt restore my database after the crash. I’m going to mail tomorrow & HOPE they can.. But I somehow dont think they will :s Its a lesson. You cant even trust the people you pay to do it, to backup & safeguard your valuable data. Thank Me I keep the valuable data here & backed up on an external location. .. pff And to think that I am seriously considering moving my blog to that environment. I might have lost my total blog data last week. Imagine that. Maybe I should make myself a book out of all this
That d be rich
So, no real reflections as of now, maybe later. Tough reflections might be more of a 31 december kind of thing. Its a healthy thing to do once in a while
On Boardgamegeek, Wikipedia, Tradgames or Mastersgames..
Its always nice to discover that there are many different ways to play a game
Anywho, I finally got a mancala set
Mini bought me one for my BDay & its just Lovely! A hand made woodcut design. Lovely
Cant wait to play! (& Win
moeha – lil hint to my future victims: link – Havent read it tough..)
19
the 26 most common climate myths and misconceptions.
• Human CO2 emissions are too tiny to matter
• We can’t do anything about climate change
• The ‘hockey stick’ graph has been proven wrong
• Chaotic systems are not predictable
• We can’t trust computer models of climate
• They predicted global cooling in the 1970s
• It’s been far warmer in the past, what’s the big deal?
• It’s too cold where I live – warming will be great
• Global warming is down to the Sun, not humans
• It’s all down to cosmic rays
• CO2 isn’t the most important greenhouse gas
• The lower atmosphere is cooling, not warming
• Antarctica is getting cooler, not warmer, disproving global warming
• The cooling after 1940 shows CO2 does not cause warming
• It was warmer during the Medieval period, with vineyards in England
• We are simply recovering from the Little Ice Age
• Warming will cause an ice age in Europe
• Ice cores show CO2 increases lag behind temperature rises, disproving the link to global warming
• Ice cores show CO2 rising as temperatures fell
• Mars and Pluto are warming too
• Many leading scientists question climate change
• Hurricane Katrina was caused by global warming
• Higher CO2 levels will boost plant growth and food production
• Polar bear numbers are increasing
Great read!
19
Addicts.. No better than a heroin junk
More info at Nicotine Addiction 101 – checkit, interesting!!
only socially accepted..