ejes consulting

Techincal Consulting Design and Automation

Posts Tagged ‘acc

Raw, Encrypted Tunnel with OpenSSL and NetCat

leave a comment »

I use netcat on my local network to transfer files very quickly without the overhead of a more complex protocol.

Just for those who don’t; here’s how:

on my home server, i transfer “myfile” on port “1024” to the computer named “MacBook”

root@homeserver:~# nc MacBook 1024 < myfile

and on my mac, i receive “myfile”, listening on port 1024

MacBook:~ ejes$ nc -l 1024 >myfile

this works, and is fairly quick.  if you need some validation that the file received is the original file, you can use md5 on Mac, and most BSDs;

MacBook:~ ejes$ md5 myfile
 MD5 (myfile) = 47f7f451e2e6d462a35a3d88b594e283

and md5sum on Linux.

root@homeserver:~# md5sum myfile
 47f7f451e2e6d462a35a3d88b594e283  myfile

Sometimes, however, I need to send a file, quickly, ad-hoc across the big ol’ scary internet.  this means that i’m sending “private” information across a “public” network.  I hate doing that, because anything on the the internet is subject to snooping.

What can we do?  Encrypt our transfer.  Thankfully, OpenSSL has the ability to help us do that.

So, to repeat the same transfer as above, but encrypted.  We setup our “listener first”, I’m listening on my mac, but the same command line would work in most BSD flavors:

MacBook:~ ejes$ nc -l 1024 | openssl enc -d -aes-256-cbc -out myfile
 enter aes-256-cbc decryption password:

and on the sending machine you need to use:

root@homeserver:~# openssl enc -e -aes-256-cbc -in built | nc MacBook 1024
 enter aes-256-cbc encryption password:
 Verifying - enter aes-256-cbc encryption password:

Of course OpenSSL supports plenty other encryption methods than aes-256, so feel free to explore. list-cipher-commands should help.

root@homeserver:~# openssl list-cipher-commands
aes-128-cbc
aes-128-ecb
aes-192-cbc
aes-192-ecb
aes-256-cbc
aes-256-ecb
base64
bf
bf-cbc
bf-cfb
bf-ecb
bf-ofb
camellia-128-cbc
camellia-128-ecb
camellia-192-cbc
camellia-192-ecb
camellia-256-cbc
camellia-256-ecb
cast
cast-cbc
cast5-cbc
cast5-cfb
cast5-ecb
cast5-ofb
des
des-cbc
des-cfb
des-ecb
des-ede
des-ede-cbc
des-ede-cfb
des-ede-ofb
des-ede3
des-ede3-cbc
des-ede3-cfb
des-ede3-ofb
des-ofb
des3
desx
rc2
rc2-40-cbc
rc2-64-cbc
rc2-cbc
rc2-cfb
rc2-ecb
rc2-ofb
rc4
rc4-40
seed
seed-cbc
seed-cfb
seed-ecb
seed-ofb
zlib
Advertisements

Written by ejes

May 1, 2013 at 9:12 pm

Tutorial: iPhone Ringtones for Free!

with one comment

 The iPhone is the ultimate handheld platform, it’s very well designed (like most Apple hardware and software) and has a vast list of features.
One of which is Ringtones.

I’ve seen literally hundreds of sites advertising their rss feed, podcast, or immediately downloadable ringtones for your iPhone.

I also found a few sites (for example: http://theappleblog.com/2008/08/07/free-custom-iphone-ringtones-using-only-itunes/) on how to create ringtones.  (amazing tutorial by the way, works like a dream)

But what if you don’t have the song in your library?  I like having video game music as my ringtone, especially obscure ones like “Mario Kart Wii – Star Man”

So, what I did is found a copy of Mario Kart Wii – Star Man in MP3 format.  (http://www.vgmusic.com)

After downloading it, I could just import it into my iTunes library, convert it, and insert it on my iPhone like the tutorial suggests.

But, I’m difficult.  I don’t want to mess up my library, and I wanted a slightly lighter process than the one listed.

I also wanted to be able to do it on ANY operating system, for free and with no legal ramifications.

My favorite tool (lately) for converting media formats is VLC.  (http://www.videolan.org/)

Other than being able to play any format known to man (and some that aren’t), VLC can convert from one format to another.  It’s interface isn’t very good, but it’s workable for our process.

So, now i have an mp3; it’s shorter than 30 seconds which is the maximum length the iPhone accepts for a ringtone, so I can use this one out of the box.  If it WERE larger than 30 seconds I would probably trim it using “SoX” (Sound eXchange) (http://sox.sourceforge.net/)

Now load up VLC.

Select “Media -> Convert / Save”.

Now, the tricky part. 

On the “Encapsulation” tab select MP4.  Set up a “File” while you’re here.

VLC transcode options (m4r) screenshot 1

VLC Encapsulation Options

 

 Then select the “Audio codec” tab, and enable it.  Set the Codec to “MPEG 4 Audio (AAC)“.  Ensure the bitrate is 128 kb/s and the 2 channels.

VLC

VLC Audio Codec Options

 

That’s it.  Press Save.

Change the extension to “.m4r”, and import it into iTunes, sync it with your iPhone and select your new Ringtone from the Settings screen.

For the lazy, I wrote a batch file that should do this for you:

https://ejesconsulting.wordpress.com/scripts/mp3-to-m4r-bat/

Written by ejes

June 8, 2009 at 1:44 pm

Posted in Tutorials

Tagged with , , , , , , ,