Believe it or not, here is a simple webserver in 1 line of shell code. This is nothing new but fascinating.
:;while [ $? -eq 0 ];do nc -vlp 8080 -c'(r=read;e=echo;$r a b c;z=$r;while [ ${#z} -gt 2 ];do $r z;done;f=`$e $b|sed 's/[^a-z0-9_.-]//gi'`;h="HTTP/1.0";o="$h 200 OK\r\n";c="Content";if [ -z $f ];then($e $o;ls|(while $r n;do if [ -f "$n" ]; then $e "`ls -gh $n`";fi;done););elif [ -f $f ];then $e "$o$c-Type: `file -ib $f`\n$c-Length: `stat -c%s $f`";$e;cat $f;else $e -e "$h 404 Not Found\n\n404\n";fi)';done
Similar webserver I found written in ruby. Being the sys-admin type of guy; I admire the power of shell over any other programming language.
# From: http://www.ntecs.de/blog/articles/2008/02/09/the-worlds-smallest-webserver
# Author: Michael Neumann
# ... point your browser to http://localhost:3125/etc/motd
ruby -rsocket -e 's=TCPServer.new(5**5);loop{_=s.accept;_<<"HTTP/1.0 200 OK\r\n\r\n#{File.read(_.gets.split[1])rescue nil}";_.close}'
This is nothing new to me but for some its perfect demonstration of what electromagnetic can do to assist hackers. I've known about this for 5+ years now - never really saw it being done but its been done easily in the past by hackers. That is why big corporations now insulate their server rooms from outside signals.
Also, this is not limited to keyboards, you can also do similar hack on network cables, atm machines and tv remotes etc. Here is a demonstration video.
"We conclude that wired computer keyboards sold in the stores generate compromising emanations (mainly because of the cost pressures in the design)," they write here. "Hence they are not safe to transmit sensitive information."
Another fascinating tool I stumbled upon. Never thought I would ever need anything like this but this was very useful for a secret project I am working on.
This memory analyzer gives you a good overview of your memory utilization based on segments. Which objects are using how much memory and whats garbage collector up to.
![]()
It reads in dump files - on OSX they suggest using jmap.
So far it will tell you :-
What are the sizes of the collections, which my objects are keeping?
What is the fill ratio of the collections held by my objects?
Are the hash functions of my objects really working fine?
An easy way to look at the content of HashMaps
Arrays!
* "Arrays Grouped By Size" - works on both primitive and Object arrays
* "Array Fill Ratio" - does not work on primitive arrays. Provides the ratio between non-null elements in the arrays and the length of the arrays
I have been doing a bit of research and reading on SEO. Stumbled upon a quite a few neat tricks webmasters are using these days to increase their ranks on google search. In process I've managed to hack a few of my own (will post later). So I will wait for how effective they turn out to be sharing.
Also, came across this tool which in the past was only available via Google Adwords account, but now you can use it externally https://adwords.google.com/select/KeywordToolExternal .
It allows you to generate a nice keywords list in a comma seperated fashion which you can then put it in your meta tags.
I used something Ruby | Rails taught me in m java jdbc assignment. It's not related to rails in any way then SQL in general. It's the concept of using Prepared statements.Really useful in this particular scenario.
public String showLoanedBooks() {
public String showLoanedBooks() {
PreparedStatement sa = null;
PreparedStatement sb = null;
String result = "";
boolean r = false;
String selectbooksql = "SELECT DISTINCT ISBN, Title, Edition_No, NumofCop, NumLeft FROM Book NATURAL JOIN Cust_Book;";
String selectauthorsql = "SELECT Surname FROM Author NATURAL JOIN Book_Author WHERE ISBN = ? ORDER BY ISBN;";
String selectcustomersql = "Select CustomerID, L_Name, F_Name, City from Customer natural join Cust_Book WHERE ISBN = ? ;";
try{
result = "Show Loaned Books: \n\n";
Statement s = con.createStatement();
sa = con.prepareStatement(selectauthorsql);
sb = con.prepareStatement(selectcustomersql);
ResultSet rs = s.executeQuery(selectbooksql);
while (rs.next()){
r = true;
//Going through each book Book
If you ever need to steal a streaming video then mplayer is the tool of choice.
I had to recently steal some streaming lecture videos from MIT for educational purposes off course. As lecturers at my university can't teach for shit.
Any way here is how you do it
mplayer -dumpstream -dumpfile "File Name Here.rm" "URL Here"
In case of MIT lecture videos I had todo the following
wget http://mfile.akamai.com/7870/rm/mitstorage.download.akamai.com/7870/18/1...
Once' you've got the .rm file you have to open it up! The real deal is inside it.
more strang-1806-lec21-29oct1999-220k.rm
rtsp://a757.v7870e.c7870.g.vr.akamaistream.net/ondemand/7/757/7870/v0001/mitstorage.download.akamai.com/7870/18/18.06/videolectures/strang-1806-lec21-29oct1
999-220k.rm
--stop--
pnm://a757.v7870e.c7870.g.vr.akamaistream.net/ondemand/7/757/7870/v0001/mitstorage.download.akamai.com/7870/18/18.06/videolectures/strang-1806-lec21-29oct19
99-220k.rm
Things to watch out for when configuring sendmail. Specially when deploying it for relaying mail for php via your ISP.
Although I thought sendmail was a out-of-box solution for this but I've ran in to this trap so many times that I thought I might as well document it for future, instead of googling everytime.
On debian based distro anyway you just go ahead install sendmail as such.
sudo apt-get install sendmail
Once installed make sure your hostname is correctly configured for that machine. Anything like localhost.localdomain will make sendmail shat itself.
You can always check the log for sendmail to see whats going on.
sudo tail -f /var/log/mail.log
So, open up hostname and hosts file in /etc/
Inside the hosts file make sure it looks something like this
127.0.0.1 localhost
192.168.3.1 yourwebsite.co.nz webserver
Also make sure webserver is the name also mentioned in your hostname file.
Once done that you can restart this service for it to take effect and restart sendmail too.
I've been challenged by lack of cURL's ability to follow javascript redirects such as
document.location.href=dyJvo;
Some people do this for security reasons as they don't want scripted or bots to be able to access the web page.
So this is how I change the rules of the game.
When I do a normal cURL get request I get the following response
TGP Brownie
function kgDgcxsJR() {
var lbyXE = 'YdJrjlIwdWIspCNn';
var tKedu = 'wkenESdrNlxONGIE';
var dyJvo = 'QFPgzysIDcNdszwh';
var mFvGU = 751092;
var RZvuP = 432329;
mFvGU = mFvGU + RZvuP;
dyJvo = 'http://www.xyz.com/cgi-bin/brownie/submit.cgi' + '?' + 'fp=' + tKedu + mFvGU + dyJvo + lbyXE;
document.location.href=dyJvo;
}
Please turn on JavaScript
Finally a "real" gaming console! This is the sort of stuff that big companies try and stop develop otherwise they run out of ways to make money! This is not pandora
is all about. Have a look at its features
![]()
ARM cpu - the most compatible linux cpu ever made. ARM CPU's are specially developed to run with linux.
Dual SDHC card slots means you can emulate more then one game from different consoles at the same time, which is really cool.
I recently implemented a distance vector algorithm in C. Using a network simulator called cNET network simulator.
Runs straight out of the box for BSD based operating systems but for debian I had to hack it. Will outline the hack in a different post.
After implementing the distance vector algorithm the network load has also reduced as less links get less congested with packets. The only packets that get sent now are only that needs to update tables on neighboring nodes. Two types of packets are sent ROUTE and DATA packets.
![]()