Can I install anything on this limited system?

0

My modem has a telnet port and when I login to that port I get a root shell in device. The commands are very limited but there is empty space in device. Can I install something like nmap to this device? There is no package manager and I guess this system is running at init 1.

# cat /proc/partitions 
major minor  #blocks  name

  31        0        128 mtdblock0
  31        1         64 mtdblock1
  31        2         64 mtdblock2
  31        3       1152 mtdblock3
  31        4       6784 mtdblock4
  31        5       8192 mtdblock5
# uname -a
Linux Air5453 2.6.30 #1 Wed Dec 3 18:43:00 EET 2014 mips GNU/Linux
# free
              total         used         free       shared      buffers
  Mem:        59456        35008        24448            0         4048
 Swap:            0            0            0
Total:        59456        35008        24448
# busybox 
BusyBox v1.14.1 (2014-12-03 18:47:37 EET) multi-call binary
Copyright (C) 1998-2008 Erik Andersen, Rob Landley, Denys Vlasenko
and others. Licensed under GPLv2.
See source distribution for full notice.

Usage: busybox [function] [arguments]...
   or: function [arguments]...

        BusyBox is a multi-call binary that combines many common Unix
        utilities into a single executable.  Most people will create a
        link to busybox for each function they wish to use and BusyBox
        will act like whatever it was invoked as!

Currently defined functions:
        [, [[, arp, ash, basename, blkid, cat, chmod, cp, cut, date, depmod,
        dhcprelay, dmesg, dumpleases, echo, egrep, eject, false, fgrep,
        findfs, free, ftpd, fuser, getty, grep, halt, hostname, httpd,
        ifconfig, init, inotifyd, insmod, kill, killall, klogd, ln, login,
        ls, lsmod, lzmacat, makedevs, mdev, mkdir, mkdosfs, mkfs.vfat,
        modprobe, mount, mv, pidof, ping, poweroff, ps, pwd, reboot, rm,
        rmmod, route, sh, sleep, tar, telnetd, test, tftp, top, touch,
        traceroute, true, udhcpc, udhcpd, umount, uname, unlzma, uptime,
        vconfig, wget, which

Can I also install dropbear to this device?

# clear
-sh: clear: not found
# mount
rootfs on / type rootfs (rw)
/dev/root on / type squashfs (ro,relatime)
proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
ramfs on /var type ramfs (rw,relatime)
ramfs on /dev type ramfs (rw,relatime)
devpts on /dev/pts type devpts (rw,relatime,mode=600)
none on /proc/bus/usb type usbfs (rw,relatime)
# cat /proc/mounts 
rootfs / rootfs rw 0 0
/dev/root / squashfs ro,relatime 0 0
proc /proc proc rw,relatime 0 0
sysfs /sys sysfs rw,relatime 0 0
ramfs /var ramfs rw,relatime 0 0
ramfs /dev ramfs rw,relatime 0 0
devpts /dev/pts devpts rw,relatime,mode=600 0 0
none /proc/bus/usb usbfs rw,relatime 0 0

Halox

Posted 2016-02-01T09:48:27.267

Reputation: 84

You mention that there is free space on your device, yet you only provide the output of free and the contents of /proc/partitions to demonstrate this. Note that the former gives information on RAM usage, not disk usage, and the latter gives information on partition sizes. Use mount (or cat /proc/mounts) and stat -f to find out how much disk space there's left. – bertm – 2016-02-01T10:14:10.630

stat command does not exist on the system. Output of other commands have been added but they does not give any info about the disk size. – Halox – 2016-02-01T10:18:59.187

You need to use the dmesg command to review the boot log, which could reveal much more about this embedded system (e.g. processor). The squashfs mentioned in the mounts indicates that "installing" anything to the rootfs will take a lot of work. "I guess this system is running at init 1" -- Embedded systems often use the simplified Busybox sysinit, which doesn't use runlevels. – sawdust – 2016-02-01T19:51:59.417

Answers

1

From the output of the commands it appears that all filesystems that are mounted read-write are temporary ones, not backed by non-volatile memory. /dev/root is probably a symbolic link to one of the mtdblockX devices, the other partitions are likely to be for the bootloader and configuration. While there may be some free space there if you would remount it read-write, nmap is several megabytes large already, not to mention its dependencies, and is unlikely to fit on your device even if there was free space.

It looks like your device has USB support. Depending on your definition of "install", a solution would be to mount a USB flash drive you prepopulated with the binaries you'd like to run, or even use the available ftpd to modify its contents remotely.

The hard part is acquiring the software that will run on your device. You need a build that is compiled for the MIPS processor in your device, so that may require cross-compilation or finding a binary already compiled for your device (or a device with a compatible processor, kernel, libc and such).

bertm

Posted 2016-02-01T09:48:27.267

Reputation: 151