-
Notifications
You must be signed in to change notification settings - Fork 4
Home
Seacrane is a thing to help you do things.
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.
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)
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 |
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 (╯° °)╯︵ ┻━┻
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 is named after these:
They keep everything "level" as you go about doing the work.
Some examples of Seacrane usage.
setup | client |
---|---|
Too big to GIF. MP4 version
To test this out we will:
- run Seacrane on a phone
192.168.7.234
, start the socks proxy there. - Then run seacrane webserver on a computer
192.168.7.140
- We will configure Firefox on the computer and configure it to connect out through the SOCKS proxy on the phone.
- 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. ) - 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)
Note the ip of the phone on the far right.
We will use Firefox because we dont use it for anything else and maintains its own Proxy settings.
IT WORKS! The webserver thinks we are browsing from the phone and not the computer.
ok, this didnt make it into seacrane ;-) https://hub.docker.com/r/sa7ori/ocrdocker GIF version Full 90second MP4 version
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.
You can run most of the Seacrane commands from your shell without entering interactive mode.
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. |
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".
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.
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.
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.
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.
Seacrane on MIPS required changing build-scripts around betwen GOARCH=mips
and GOARCH=mipsle
and adding GOMIPS=softfloat
helped to avoid a illegal instruction segfault I was getting in the normal binary on OpenWRT MIPS
- 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
andhttpdir
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.