Tagged: linux

Hakology Day 82: Digistump … rickroll all the things.

[0657]
Well merry crimbo, I hope you had a great day whatever you spent it doing. So i’ve been really busy the last few weeks but I’m starting to have a little more free time now … and thought I’d take this chance to start writing up a little code and project for the digistump.


What is a digistump?

A digistump is a small USB development board that emulates a HID (Human interface device (Usually a keyboard or mouse but there are other variants)). The digistump allows the user to flash up to 6k of code to the device which when plugged in to a computer after programming will execute the code on the device as if it were a keyboard and/or mouse.

Why would I use one?

Its very handy for automating small tasks such as downloading a file and running an install or just editing settings on the pc that remain consistent across operating systems. eg. You could use the digistump to run a command in the command window or run a specific application with certain options automatically. All you need to do is plug the device in after programming and it will start executing the pre-programmed keypresses.

What operating systems does it support?
The digistump is cross-platform this doesnt mean one script works for all operating systems. This means the device is capable of running and executing code on Win/Linux/Mac but due to difference across the various operating systems scripts would need to be customised for each. The digistump has no way of reading data or accepting any feedback from the PC it just blindly presses keys. Your scripts will rely heavily on intelligent timing. Some commands will execute and finish on modern PCs faster than they would on older hardware, this has to be taken in to consideration when writing code.

Where can I get one?
The digistump is available from Digistump.com you can also find them available on ebay and similar sites. I bought mine from ebay for £1.50 each which is a tiny amount when compared to similar devices.

Installation?
The install procedure is pretty straight forward, download arduino IDE, install drivers and add digistump examples and templates. Which is all detailed on this page here … Getting started with the digistump
The setup is relatively straight forward.

So why am I reading all of this?

Well b/c the digistump is a relatively new product there’s not a lot of reference material on the internet so I started developing a small framework to make it easy to deploy and develop code very quickly. I’ve been busy working on my first little project for the device and right of passage to rick roll any windows 7 users. Although this project is a harmless bit of fun it’s helping me to develop a lot of standardised functions for running applications, opening web pages creating and saving files.

Rickroll notes …
I spent the first few nights tearing my hair out with this device. Here are some of the issues I encountered and how I mitigated them or formed some workarounds.

The first major issue I had was the backslash. The digistump by default outputs US scancodes, as I live in the UK this was an issue. So after much googling and head scratching I figured out that the scancode for the backslash on a UK keyboard was 0x64 yet the digistump was sending 0x31 the US scancode for the backslash.

Whilst I couldn’t figure out where the digistump library resided on the PC I wrote a small function to swap out the 0x31 for 0x64 which seems to have remedied my backslash issues. This is not the correct way to do things.

Eventually I found the library location last night (c:\Users\Username\arduino15\… ). I’m still yet to look through the code and figure out a conversion table for 101(UK en-gb 32) keyboards. Given a little more time I’ll get this fixed and not have to use any functions for string processing.

Another related problem was the saving of files using the %USERPROFILE% environment variable. Full filenames containing this variable were not being parsed properly ie. the environment variable was being read as %USERPROFILE% and not the actual users name. To mitigate this I broke the file string down in to sections and type each part of the save file string in separately. ie. C:\ [ENTER] Users\ [ENTER] %USERPROFILE%\ [ENTER] etc which allowed me to use the %USERPROFILE% variable when saving files.

I’m not going to upload all the code yet as its still messy and I have some functions that need more calling parameters adding so if I released the code now it’ll probably change before the final release and I want everything nice and polished before I release everything.

A great big shout to advancednewbie who’s been working on a special script for the digistump (More on that very soon.) his research and project helped me greatly in trying to figure out the key mappings for most default buttons and some of the UK differences. Given some more time im sure we’ll have this working seamlessly between countries and keyboard layouts.

Even though these issues don’t directly relate to the rickroll project I thought I’d include them just in case anyone else is having similar issues.

Download digispark digistump stumpyroll source code
[/0657]

Hakology Day 35 : Blog Entry

[1825]
Reflecting on the weekend, have been working on a few projects. One using the max7219 LED matrix driver, which I’m considering writing my own library for as everything i’ve tried seems to fail, I have it working and can address each LED individually but haven’t been able display anything useful ie. fonts or text effects … anyway that’s a work in progress. I turned my hand to configuring a small 1.3″ OLED screen someone donated a while back now I can see it was some kind of addressing issue in the code I initially got it running (there were 2 pixels columns on the far right filled with random bits and a couple of leading pixel columns missing) anyway its working now I noticed the version I was running was from the google code repo and checked github see if the project was still live and found some more recent libraries, installed those and that seems to have remedied the problem.
[1825]

[0023]
Managed to sort out a good method for screen capture in gnome3 debian jessie. Was having issues capturing the screen in a format I was able to get in to my editing suite. Inadvertently I found out that debian jessie has built in screencapture/screencast ability. Pressing shift+ctrl+alt+R, a small red dot will appear in a panel near your login/logout  panel to show if you are recording, files are automatically saved to your home videos folder, to stop recording just hit the keyboard shortcut again.

These files happen to be in webm format, I havent yet tried running the webm files through handbrake to see if I can convert them to mp4 as my editing suite doesnt natively support webm and one huge problem with the built in screencast is it only records my desktop and no audio. (Maybe I’m doing something wrong, would be easier to just use the built in screencapture)

So eventually my final solution was to record using kazam to mp4, this captured the video + audio, was even hoping I wouldnt have to transcode it again, but still the default format output by kazam isnt compatible with vegas, I then ran the files through handbrake and imported them and everything seems ok … now all the audio syncs with the video perfectly.

Its a bit of a mess/bodge job but it works, maybe if I get some time in future I might have a look see if its possible to edit the default screencast settings to capture audio+video and output to a compatible format preferably mp4.

NB. The default screen recorder only allows you to record for 30 seconds use the following line in terminal to change the maximum record time.
gsettings set org.gnome.settings-daemon.plugins.media-keys max-screencast-length 45
[/0023]

Hakology Day 18 : Blog Entry

[0915]
Feeling a lot better today but still a little under the weather. Have to do a few jobs this morning but should be online and creating later.
[/0916]

[1352]
Picked up a PC for an upgrade 256gb SSD and PCIE wireless card. Just sorting that out and having a brew.
[/1352]

[1412]
Waiting for images to burn, files to copy etc. Had a good play with kodi whilst I’ve been ill an I’m pretty impressed, makes it easier in some ways to watching content on your PC.
[/1412]

[1441]
This program http://download.wsusoffline.net/ has been a real time saver, when people ask me to install windows 7 for them usually the update service is borked and needs fixing, quite frankly the MS tools are diabolical this seems to be the best / quickest way to patch and repair the windows update service.
[/1441]

[1508]
Setting up wordpress for a new web client. Almost done with all my jobs for the day then hopefully get down to some recording even if its only a vblog.
[/1508]

[0004]
Knackered and my head is aching, going to call it one for today. Finished all the updates on that build and also dropped debian jessie into a separate partition for them to try as they’d asked about linux. Need to be up early tomorrow and get that website online. Honestly not worth me recording a vlog b/c I’m still pretty flued up.
[/0004]

Hakology Day 9 : Blog Entry

[1124]
So it begins, late night last night, got the SDR working under windows. Todays goals, get the SDR working under linux and gqrx, look at what I managed to capture in the log and start a video showing how to setup SDR#.
[/1124]

[1215]
Really don’t want to stop logging messages lol, but I suppose its time to start making notes. Once I can get this running on the RPi ill leave it logging 24/7 for a while so I can analyse the data. Still lots of data being sent that shouldn’t be, names, phone numbers, address information, IP addresses, email addresses, URLs … and I’m sure if I log for long enough the obligatory username and password.
[/1215]

[1306]
So I can’t show or share any of the data I’m collecting. Hibby just pointed me to (Legal stuff) … even though I can’t share the data I can show you how to demodulate the signals yourself.
[/1306]

[1415]
Written up notes for SDR# installation.
[/1415]

[1513]
Executing operation tidy up for recording later also doing a few other chores.
[/1513]

[1606]
Still tidying 🙁 b/c I’m a messy bugger.
[/1606]

[1613]
Random picture for today …
Since I’m working on radio stuff here’s my baofeng handset its the uv-5r, a great starting handset for people looking to get in to HAM radio and start learning. I bought one relatively cheap on ebay around £20, before I got my licence so I could scan and listen a little. I’ve some other scanners and sets but ill save those for another day.
baofeng
[/1613]

[1713]
meh RL … need to script my house work or hack together some sort of roomba capable of washing up and making tea/coffee on demand.
[/1715]

[1824]
Chilling out time for a coffee and some food. BBL
[/1825]

[21.41]
A few pages of notes written and a rough idea for an introduction to SDR. Time for a brew and to record / talk through the audio. Will report back in a while.

Useful links:
https://en.wikipedia.org/wiki/Radio
https://en.wikipedia.org/wiki/AM_broadcasting
https://en.wikipedia.org/wiki/FM_broadcasting
https://en.wikipedia.org/wiki/Software-defined_radio
http://www.sigidwiki.com/wiki/Signal_Identification_Guide

Captured a little extra audio for the hakology introduction too.
[/2147]

[2344]
Sleep required.
[/2344]

[0448]
Woke up after a few hours sleep been doing a little radio research, too early to start the next blog entry, too late to be editing this one hmmm.
No vblog for day nine either will have to make up for it later.
[/0450]

Hakology Day 3 : Blog Entry

[12.33]
Good morning hakologists, mental note go to bed earlier. Coffee time then on with some research think I’ve decided on doing a really boring video tonight we’ll see. I need more time to compile a decent SDR episode but may well do a little v-blogging today, need to get the garage sorted out. So glad to be back computering.
[/12.33]


[13.01]
Now I’m more awake I’m going to have a look at setting up my SDR rig the question is under linux on an old dual core atom or under windows on an i5 …. urgh windows.
[/13.01]


[13.37]
Major panic over located my SDR, time to get the environment setup and working … oh fun 🙂 will post some bonus twitter / WP content when I can get a decent picture of what I’m working on.
[/13.37]


[14.27]
Tea break, have some defcon vids on in the background, looking for a little inspiration and mental refreshment, realised I wasnt following Balint Seeber @spenchdotnot … well I am now.

[/14.27]


[15.13]

Well I’ve got the sdr working! Progress.
[/15.13]


[15.44]
Taking a breather for a while, need to start noting frequencies and gathering some stock footage. So far my refresher today has taught my its gqrx for linux, sdr# for windows and rtl-sdr gets installed with gqrx, need to also sort out a ‘better’ antenna so much noise in my flat. Anyway …. break time.
[/15.44]


[16.41]
Spent the last hour or so taking a ‘break’ scanning with the SDR made me remember how critical height and position are when transmitting / receiving RF. Also have the ALFA sitting next to my rig might do a little war driving for shits and giggles.
[/16.41]


[18.00]
Social, doom4 and insurgency time.
[/18.00]


[23.26]
So my social time over ran, lol, back to the grindstone.

As promised random bonus content for the blog. Here’s a picture of an old swiss army knife and yes its seen better days and is missing a few parts/utilities its a very special one. This was my dads, dads, pen knife who I never got to meet but my dad gave me this a few years ago, dug it out tidying the other day. Will try and keep posting one original picture every so often.
[/23.26]

[1.31] [06/10/2016]

[/1.31]

[4.47]
Really gone to town on the rpi retropie tutorial, signing off.
[/4.47]

Hakology – Zeya linux installation (HTML5 streaming music)

*repost for archiving purposes*

# Notes:
# Requirements
# Python 2.5+ (2.6+ recommended) tested on 2.7 (worked fine)
# python-tagpy (critical : boost lib)
# python-simplejson (critical : boost lib)
# oggenc (critical : ogg encoder for streaming)
# mpg123 (optional : for decoding MP3 files) (you will want this)
# flac (optional : for decoding FLAC files) (you might want this)

echo "Hakology - Zeya installation script for linux."
echo "Zeya is a client for streaming audio from a central servernto any device that supports html5"
echo "Zeya - web.psung.name/zeya/"
echo "Hakology - youtube.com/hakology"
echo "Visit the youtube channel for more coolness"

cd ~
sudo apt-get install python git mpg123 flac python-tagpy vorbis-tools faad python-simplejson
sudo git clone http://web.psung.name/git/zeya.git

echo "############################################"
echo "Installation complete"
echo "############################################"
echo "To run :";
echo "./zeya.py --path=/path/to/music";
echo "To add to crontab (crontab -e) add the following to start on reboot";
echo "@reboot /full/path/to/zeya.py --path=/path/to/music";
echo "You should add a htaccess file to use this on the web";
echo "./zeya.py --basic_auth_file=/path/to/.htpasswd --path=/to/your/music/";
echo "You can also run on a different port";
echo "./zeya.py --port=9000";
exit