Skip to content
s7ephen edited this page Oct 7, 2022 · 31 revisions

Seacrane is a thing to help you do things. MainHelp

Note: There are embedded video gifs throughout this markdown, but it seems that Github wont render them if javascript is disabled in your browser

Also note: Some of the gifs and mp4s are slower than they were supposed to be. I will fix later.

Description/Summary

A multi-architecture multi-platform interactive multi-tool. (Windows, Linux, OSX, Android, MIPS, x86, ARM). It is designed to hopefully relieve the tableflipping rage induced when you're trying to do simple things (quickly) as you move between machines/phones/embedded devices and DON'T want to install elaborate software or use yet another stupid cloud service. It packs all this stuff in a single binary. This includes stuff like:

  • encrypt a file
  • download a file from another device
  • upload a file to another device
  • proxy through another machine (SOCKs or tcpport)
  • base64 encode/decode something
  • share a clipboard copy/paste buffer with another device
  • chat on a LAN
  • send a secret (encrypted message)
  • and more (see the examples section or the list of commands)

What do you use it for (Use-Cases)?

Use Case Command(s)/Feature(s)
Need to quickly copy a URL from phone to my computer (or vice versa) Multicast Chat, Webchat, QR file encode
Need to copy a file to my phone from computer Http Download (httpdl), QR File Encode, Http Server (httpdir), Httpd Receive (httprecv)
Want to chat on my LAN with friends quickly and easily. Multicastchat, Webchat
I need to make a QRCode really quickly qrcode
I need to send a strongly encrypted file aes_fileencrypt/aes_filedecrypt
I need to decode a QRCode and dont want to use a cloud service qrcode
On my network, only one of my computers is allowed to connect to the internet but another needs access. Socksproxy, Socksproxy CONNECT (aka TCP over SOCKS),portforward
I want to copy only unique files from my bloated Download directory. filedups
I need to extract all the URLs from a log file. findurls
I'm on an embedded system with no compiler and there is not netcat nc_dash_l
I'm on an embedded system with no compiler and there is no curl or wget httpdl
I'm on an embedded system with no compiler and there is no uuencode/base64 base64enc/base64dec, string_base64(enc/dec)
I have a directory full of images that I want to "grep" for text in the images. not in seacrane, but this works

Why?

If you use a bunch of different devices, you probably already know why: moving between shells, servers, phones, routers, and other devices. When focusing on complex tasks nothing is more annoying than getting blocked by stupid simple tasks. For me it is the main driver for procrastination, annoyance, profanity, and (╯° °)╯︵ ┻━┻

What does it run on? And Downloads:

It runs on lots of stuff, phones, routers, desktops, whatever. You can obviously clone and compile the project yourself, but if you need a quick download:

OS Arch Supported? Download Link**
Windows x86 ../bin/seacrane.exe
Linux x86 ../bin/seacrane
Linux ARM ../bin/seacrane-arm
Linux MIPS ../bin/seacrane-mips
Linux MIPS (le) ../bin/seacrane-mips-le
Linux MIPS (sf) ../bin/seacrane-mips-sf
OSX ARM ../bin/seacrane-osxarm
OSX x86 ../bin/seacrane-osx
Android ARM ../bin/seacrane-android
Android APK bundle 🗸 (coming)
Apple iOS (arm) 🗸 built but not on App Store NA
JS/WebAssembly 𐄂 NA

** There is probably a better way to do a Download page, I will maybe setup Github Releases sometime.

Seacrane on ..

Librem

seacrane_librem.png

Router

seacrane_on_routers.png

Why the name?

Seacrane is named after these:

SeacraneGif

They keep everything "level" as you go about doing the work.

Examples, Usage, & Demos

Some examples of Seacrane usage.

List of Commands

MainHelp GIF version MP4 version

Built-in Webchat

setup client
webchat_setup.png webchat_on_mobile.png

Webchat Setup

WebChatSetup.gif GIF version MP4 version

Using Webchat

WebchatDesktop.gif GIF version MP4 version

Multicast Chat

Too big to GIF. MP4 version

SOCKS Proxy

To test this out we will:

  1. run Seacrane on a phone 192.168.7.234, start the socks proxy there.
  2. Then run seacrane webserver on a computer 192.168.7.140
  3. We will configure Firefox on the computer and configure it to connect out through the SOCKS proxy on the phone.
  4. then use the Browser to browse to http://192.168.7.140/getip (with /getip being a special method in the built-in Seacrane http server that shows the client's IPaddress. )
  5. If it works then then the IP reported should not be of the computer, it should be of the phone (which we are proxying through)

SOCKs Proxy Step 1:

Note the ip of the phone on the far right.

seacrane_librem2.png seacrane_librem.png

Step 2:

We will use Firefox because we dont use it for anything else and maintains its own Proxy settings. socks_step2.png

Step 3

socks_step3.png

Step 4 & 5

IT WORKS! The webserver thinks we are browsing from the phone and not the computer. socks_step4_and_step5.png

File Encryption

Aes.gif GIF version MP4 version

String Encryption

stringencryption.png

QRCode Encoder/Decoder (qrcode)

qrcodes.png QRCodes.gif GIF version MP4 version

Getting the local and public IP (getip)

GetPublicIP.gif GIF version MP4 version

Receive a file via HTTP (httprecv)

HTTPRECV.gif GIF version MP4 version

Share a directory via http (httpdir)

Httpdir.gif GIF version MP4 version

HTTP downloader (httpdl)

httpdl.png

Finding Duplicate Files (and making a directory snapshot) (filedups)

filedups.png filedups.gif GIF version MP4 version

Port Forwarding (portforward)

portforward.png

Zip up a directory (zipdir)

pwdAndZipdir.gif GIF version MP4 version

Base64 Encode/Decode and URL Encode/Decode

Base64encodeAndURLEncode.png

OCR Images in a directory

ok, this didnt make it into seacrane ;-) https://hub.docker.com/r/sa7ori/ocrdocker ocrdockerbonus.gif GIF version Full 90second MP4 version

Other features

Cisco ios-style nested "submenu" commands.

Might seem like a small thing but this is something extremely useful from the Python 'Cmd' module that is a must-have for a interactive cli framework. feature_cli_submenuing.png

Non-interactive mode

You can run most of the Seacrane commands from your shell without entering interactive mode.

feature_noninteractivecli.png

Full list of Commands

A summary of Seacrane Commands (similar to the 'help').

Command Description
aes_decrypt_string AES Decrypt a string and print it to the screen.
aes_encrypt_string AES Encrypt a string and print it to the screen.
aes_filedecrypt Decrypt a file (symmetrically AES) without reading it into memory.
aes_fileencrypt Encrypt a file (symmetrically AES) without reading it into memory.
base64dec Base64 Decode a file and write it to disk. (gzip decompresses after b64 decode)
base64enc Base64 Encode a file and write it to disk. (gzip compresses first)
clear clear the screen
exit exit the program
filedups Recursive into directory finding files with identical contents. Also saves a 'directory fingerprint' log to disk.
findurls Find all URLs in a file printing some to screen and saving all to a file.
getip List all local network interfaces and their IPs (and other information)
getpublicip Hit http://ifconfig.me for Public IP address info. run 'getpublicip all' for more info
help display help
hexdump Hexdump the contents of a file.
httpdir Serve a directory as an http index.
httpdl Download a http file directly to disk without storing it in memory. (like curl -O)
httprecv Receieve a http file upload via embedded http server.
multicastchat Start a multicast listener, for messages from other Seacrane LAN instances that multicastchat_send
nc_dash_l Listen on a TCP port and hexdump everything received. (like 'nc -l', hence the name)
portforward Perform a TCP or UDP port forward. Example: seacrane>>> portforward tcp 8080 google.com 80
pwd Print working directory.
qrcode Enter the QRCode submenu (has useful commands for encoding/decoding qrcodes).
socksproxy Starts a Socks5 proxy server. (with support for CONNECT method (aka tcp over http))
string_base64dec Base64 Decode a string and print to screen.
string_base64enc Base64 Encode a string and print to screen
urldecode URLDecode a string.
urlencode URLEncode a string.
webchat Spawn a Web Chat server. Very useful for sharing copy/paste buffers across machines.
zipdir Zip up an entire directory recursively.

Developer's Notes:

This project was a few years in the works and at the time it was a warmup (and necessary tooling) for another larger project. For the Golang experts and purists, I was new to Go when this was written so my goal was to just "make it work" with few frills except for a few wishlist items (to find a python 'Cmd'-like module for golang, etc). Lots of additions had to be removed because they didnt play well with other platforms or architectures. I may iterate on it publicly and polish quite a bit later, so if you have non-aesthetic tips or tricks, I am open to them. This project has since forked into a public and nonpublic version so maintaining the two may slow public improvements. In the very least, I hope it can serve as code examples and reusable patterns for anyone "simlarly minded".

Why Golang?

Since Golang is basically "Python with Pointers" or "Python that sh!ts binaries". If you've spent years fighting with swig,py2exe, cross-compiling C, LLVM, you can appreciate Golang's ability to build target binaries for basically every architecture and OS from a syntactically easy language like Python. So Golang seemed perfect for a project like this where the core value proposition is "running everywhere" from a single portable binary.

Why not feature XXX?

The core principal for Seacrane is: portability across platforms. This means:

  • Single binary only!
  • No dependence on config files, berkley db, sqllite, etc.
  • No reliance on cloud services.
  • All commands must work across ALL target OS/Archs

Quite a few features were coded up and added to Seacrane but didnt port across platforms/architectures, so they were excluded (with the exception of qrcode which doesnt work on some mips and 32-bit archs and is just excluded from there builds) I am open to suggestions and feature requests though.

Why not use NCurses (or some other screen multiplexing) for stuff like the chat tool?

The goal was to only add commands/features that could successfully work across all the target platforms/architectures. Readline/NCurses and some others break across some architectures and platforms. You'll note that there is even some dead code in the sourcetree (sshdcmd, ssdh, etc) that didnt port well.

What's up with the Makefile?

I know Golang has it's own stuff, and there are newfangled build automation blah blah blah...I am old and Makefiles work.

Some of the build targets need other stuff (e.g. Android needs the NDK/gomobile) so I broke up the Make commands to support builds from the different vms/containers I use for dev.

Additionally, some commands were causing the Golang compiler to emit instructions that caused SIGILL on some platforms, so I broke things up in the Makefile to fiddle and sidestep. (see "Golang MIPS bad emit" below)

I will eventually spend some time finding Golang's #PRAGMA equivalent...dunno what they are called: "conditional compiler directives"? I looked at how Golang handles them and it wasnt as simple as #ifndef or #pragma Anyway, there is probably a more efficient way to exclude some code blocks from some architecture builds in Golang.

Golang MIPS bad emit

Seacrane on MIPS required changing build-scripts around betwen GOARCH=mips and GOARCH=mipsle and adding GOMIPS=softfloathelped to avoid a illegal instruction segfault I was getting in the normal binary on OpenWRT MIPS sigill_on_mips.png

Samples of some upcoming stuff:

  • Version numbers
  • combine httpdl to fetch new versions and other builds of seacrane.
  • PGP stuff (PGP is cumbersome without configfiles/datastores for keys and keyrings, so we'll see)
  • What I call "Whitepaper renaming" (helps with managing PDFs and other stuff) Example: https://twitter.com/s7ephen/status/990776606686789633
  • Connect.c (already basically exists with socksproxy, but add'l features planned)
  • Add directory "treediff"ing to filedups
  • combine qrcode and httpdir in a single command so it doesnt need to be done in two steps. This would allow user to select a file, a httpdir session would be opened for the file's parent directory, and a qrcode for the URL to the file automatically generated and displayed, this way no manual URL entry is required on the receiving device.
  • POST/GET for pastebin or similar services like http://transfer.sh or http://ix.io
  • WebDAV and MultiPart upload/download
  • simple sqllite/BerkleyDB query and edit tool.
  • more stuff from the private version.