Skip to content

Instantly share code, notes, and snippets.

@serpent213
Last active July 26, 2017 08:17
Show Gist options
  • Save serpent213/1fb70935f29fcf12fbf7b4331b825ccf to your computer and use it in GitHub Desktop.
Save serpent213/1fb70935f29fcf12fbf7b4331b825ccf to your computer and use it in GitHub Desktop.
% iex --name '[email protected]' --cookie '1mk0ulenVwtz4bktF15Xu2OH8xn0CjgC4Vp4KVU5QC/kIqsbXuEoF4nPTgB04zys' --remsh '[email protected]'
Erlang/OTP 20 [erts-9.0] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]
Interactive Elixir (1.4.5) - press Ctrl+C to exit (type h() ENTER for help)
iex([email protected])1> System.cmd("pwd", [])
{"/srv/erlang\n", 0}
iex([email protected])2> System.cmd("ls", ["/etc"])
{"ssl\nshadow\nresolv.conf\nprofile.d\npasswd\nos-release\nnsswitch.conf\nnetwork\nmtab\nmodprobe.d\nmke2fs.conf\nlibnl\nhosts\ngroup\nfw_env.config\nerlinit.config\nerl_inetrc\n",
0}
iex([email protected])3> model_bin = File.read!("/proc/device-tree/model")
<<84, 73, 32, 65, 77, 51, 51, 53, 120, 32, 66, 101, 97, 103, 108, 101, 66, 111,
110, 101, 32, 71, 114, 101, 101, 110, 32, 87, 105, 114, 101, 108, 101, 115,
115, 0>>
iex([email protected])4> binary_part(model_bin, 0, byte_size(model_bin) - 1)
"TI AM335x BeagleBone Green Wireless"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment