Skip to content

Instantly share code, notes, and snippets.

@qwertypants
Last active August 29, 2015 14:01
Show Gist options
  • Save qwertypants/59eac089ab9a0d2d52db to your computer and use it in GitHub Desktop.
Save qwertypants/59eac089ab9a0d2d52db to your computer and use it in GitHub Desktop.
void setup() {
system("telnetd -l /bin/sh");
system("echo setup > /dev/ttyGS0");
}
void loop() {
// Original code that prints out all data:
// system("ifconfig eth0 > /dev/ttyGS0");
// Modified code to search for "inet addr" and print out the address
system("ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}' > /dev/ttyGS0");
// Sleep is used here like the "delay" function to continuously print out the address for us.
sleep(10);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment