francescomecca.eu/output/index-15.html
Francesco Mecca 8ec44f4fac git
2024-03-06 09:18:36 +01:00

233 lines
11 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Caught in the Net (old posts, page 15) | Caught in the Net</title>
<link rel="stylesheet" href="assets/blog/fonts/opensans.css">
<link href="assets/blog/css/normalize.css" rel="stylesheet" type="text/css">
<link href="assets/blog/css/cayman.css" rel="stylesheet" type="text/css">
<meta name="theme-color" content="#5670d4">
<meta name="generator" content="Nikola (getnikola.com)">
<link rel="alternate" type="application/rss+xml" title="RSS" hreflang="en" href="rss.xml">
<link rel="canonical" href="francescomecca.eu/index-15.html">
<link rel="prev" href="index-16.html" type="text/html">
<link rel="next" href="index-14.html" type="text/html">
</head>
<body>
<div id="container">
<section class="page-header"><h1 class="project-name">
Caught in the Net
</h1>
<h2 class="project-tagline">La rete ti cattura ma libera il pensiero</h2>
<a class="btn" href=".">Home</a>
<a class="btn" href="pages/about/">About me</a>
<a class="btn" href="pages/contattami/">Contact me</a>
<a class="btn" href="archiveall.html">Archive</a>
<a class="btn" href="rss.xml">RSS</a>
<a class="btn" href="https://bugs.lezzo.org">Personal Git</a>
<a class="btn" href="https://bugs.lezzo.org/bparodi/Curriculum_vitae/raw/branch/master/latex.dir/francesco_mecca_cv_eng.pdf">Curriculum</a>
</section><section class="main-content"><div class="posts">
<article class="post"><header><h1 class="post-title"><a href="blog/2016/7/6/im-services/" class="u-url">Phone messaging apps comparison</a></h1>
</header><div>
<span class="post-date">06 July 2016</span>
</div>
<br><div class="e-content entry-content">
<p>I made this chart for a presentation at the <a href="https://cyber.law.harvard.edu/">Berkman Klein Center</a></p>
<table>
<thead><tr>
<th></th>
<th style="text-align: center;">Whatsapp</th>
<th style="text-align: center;">Telegram</th>
<th style="text-align: right;">Signal</th>
</tr></thead>
<tbody>
<tr>
<td>Source code</td>
<td style="text-align: center;">closed source</td>
<td style="text-align: center;">open source</td>
<td style="text-align: right;">open source</td>
</tr>
<tr>
<td>Api</td>
<td style="text-align: center;">none</td>
<td style="text-align: center;">various</td>
<td style="text-align: right;">library</td>
</tr>
<tr>
<td>Encription protocol</td>
<td style="text-align: center;">state of the art</td>
<td style="text-align: center;">self made</td>
<td style="text-align: right;">state of the art</td>
</tr>
<tr>
<td>Contact list location</td>
<td style="text-align: center;">cloud</td>
<td style="text-align: center;">cloud</td>
<td style="text-align: right;">cloud, encrypted</td>
</tr>
<tr>
<td>Forward Secrecy</td>
<td style="text-align: center;">yes</td>
<td style="text-align: center;">yes</td>
<td style="text-align: right;">yes</td>
</tr>
<tr>
<td>Database</td>
<td style="text-align: center;">phone storage</td>
<td style="text-align: center;">cloud</td>
<td style="text-align: right;">phone storage</td>
</tr>
<tr>
<td>Backup capability</td>
<td style="text-align: center;">Icloud or Gcloud</td>
<td style="text-align: center;">builtin</td>
<td style="text-align: right;">none</td>
</tr>
<tr>
<td>Revenue</td>
<td style="text-align: center;">ads (Facebook)</td>
<td style="text-align: center;">donation based</td>
<td style="text-align: right;">donation based</td>
</tr>
<tr>
<td>Federation</td>
<td style="text-align: center;">no</td>
<td style="text-align: center;">no</td>
<td style="text-align: right;">no</td>
</tr>
<tr>
<td>Alternative download location</td>
<td style="text-align: center;">website</td>
<td style="text-align: center;">F-Droid</td>
<td style="text-align: right;">none</td>
</tr>
<tr>
<td>Uses third party services</td>
<td style="text-align: center;">no</td>
<td style="text-align: center;">no</td>
<td style="text-align: right;">Google Cloud Messaging</td>
</tr>
<tr>
<td>Servers location</td>
<td style="text-align: center;">US</td>
<td style="text-align: center;">Russia</td>
<td style="text-align: right;">US</td>
</tr>
<tr>
<td>Tied to mobile number</td>
<td style="text-align: center;">yes</td>
<td style="text-align: center;">yes, but nickname available</td>
<td style="text-align: right;">yes</td>
</tr>
<tr>
<td>Desktop client</td>
<td style="text-align: center;">no</td>
<td style="text-align: center;">yes</td>
<td style="text-align: right;">no</td>
</tr>
</tbody>
</table>
</div>
</article><br><hr>
<br><article class="post"><header><h1 class="post-title"><a href="blog/2016/7/5/arduino_keyboard/" class="u-url">Arduino Uno as HID keyboard</a></h1>
</header><div>
<span class="post-date">05 July 2016</span>
</div>
<br><div class="e-content entry-content">
<p>Turin is the hometown of Arduino. I have been at the <a href="http://fablabtorino.org/">fablab</a> multiple times but I had to come all the way to America to get my hands on a simple Arduino Uno.</p>
<p>For 60$ I bought a cheap (but still good!) mechanical keyboard by Qisan, a clone of the Arduino Uno and a USB host shield.</p>
<p>Given that is 3 years since I have been using a dvorak layout and it's a pain to change layout on every machine that you have to use.
You can imagine that given this three pieces of hardware together I put together an hardware key mapper for the keyboard.</p>
<p>I have never had experience with Arduino before but it was not that difficult to make it do simple things like blinking the led or send signal through to a serial monitor.</p>
<p>It took me half an hour to wear down all my excitement: the USB Host Shield library broke all the compatibility with the similar project I found wandering online.</p>
<p>In particular <a href="http://hunt.net.nz/users/darran/">this blog</a> has the most precious information and the guy wrote a HID driver that allows the Uno to be seen as a HID device.</p>
<p>It was a noob error but I didn't checked the various arduino alternatives and I discovered late that just a few have the HID capabilities that would make this work easier. I should have bought and Arduino Due or Leonardo maybe.</p>
<p>Also, the various guides about flashing with a dfu tool are specific to older models of the Uno and it took me some time to figure the name of the new components so that I could flash a new firmware.</p>
<h3>A small journey in the Arduino world</h3>
<p>It feels pretentious to write a little guide for this kind of work, given also the fact that I have roughly 10 hours of experience with the Arduino. But the other resources are really outdated so I hope this piece can be useful to someone out there.</p>
<p>All the files I have used today are on <a href="http://francescomecca.eu:3000/pesceWanda/arduino_HID_keyboard">my repos</a> and I included also an outdated version of the USB Host Shield library that I used.</p>
<p>The original code from this <a href="http://hunt.net.nz/users/darran/weblog/c6f35/Arduino_USB_Keyboard_Passthrough.html">blog post</a> works like a charm but just as a simple passthrough.</p>
<p>It was not difficult at all to examine the code:
during each loop of the iteration a char array gets read from the shield and if it is contains information Arduino with the Serial.Write method send the data to the host.</p>
<p>The buffer array is a simple array of length 8 and the first two positions are reserved. In particular the first one represent the various modifier keys.</p>
<p>The dvorak layout has the same pairs as the US layout but eventually I got used to having the '@' where at the same place of 'Q' (qwerty) and '"' over the '2'.
Also, I am an avid vim user (I should thank Simone Basso for that) and I swapped some keys on the new 65 keys keyboard.
The modifier bit at the beginning of the array came in handy for my code.</p>
<p>An hardware key remapper is a simple but long switch C statement but I decided to consider also the modifier bit: in this way certain keys like the Window (UGH!) key is mapped to a different layer of keys.
I got all the codes for the HID events <a href="http://www.freebsddiary.org/APC/usb_hid_usages.php">here</a>.</p>
<p>The process of flashing the code on the Uno goes like this:</p>
<ul>
<li>write the looping code;</li>
<li>push it to the Arduino using the IDE;</li>
<li>shortcircuit the board so that it goes in DFU mode;</li>
<li>flash the .hex HID firmware;</li>
<li>try your code;</li>
<li>repeat until it's right.</li>
</ul>
<p><img alt="Everything fits in one picture" src="wp-content/uploads/2016/IMG_20160706_011304.jpg"></p>
<h3>Flashing the firmware</h3>
<p>The firmware is in my repo but I got it from (here)[http://hunt.net.nz/users/darran/weblog/a6d52/Arduino_UNO_Keyboard_HID_version_02.html].
The tool I used to flash it is dfu-programmer (version 0.62).
Every time you want to flash a new firmware the Arduino must be put in DFU mode (you can see the difference with lsusb).
To do that simply create a shortcircuit using a small metal wire on the two pins near the reset button and a led will blink.
This <a href="https://www.youtube.com/watch?v=E8XyRwXQr8Q">video</a> shows the method briefly (no real need for a jumper).
The commands are the following and there is no risk to brick the Uno:</p>
<div class="code"><pre class="code literal-block">dfu-programmer atmega16u2 erase
dfu-programmer atmega16u2 flash Arduino-keyboard-0.2.hex
dfu-programmer atmega16u2 reset
</pre></div>
<p>After each flashing the device needs to be disconnected once. Of course you can flash the original firmware back. It is included in my repo or on the official ones.</p>
<p><img alt="Arduino and the shield" src="wp-content/uploads/2016/IMG_20160706_011143.jpg"></p>
<p>That's it, as you can see is not difficult at all. The worst part is gathering the various info that are left dormant in blogs or forums.</p>
</div>
</article><br><hr>
<br><article class="post"><header><h1 class="post-title"><a href="blog/2016/5/16/lifehacks2/" class="u-url">Lifehacks (2)</a></h1>
</header><div>
<span class="post-date">16 May 2016</span>
</div>
<br><div class="e-content entry-content">
<ul>
<li>
<p>If you're at a party and you don't know anyone, make it a point to meet the host and introduce yourself. The host can introduce you to other guys/girls and it scores you points.</p>
</li>
<li>
<p>Never buy high-end cables, and never buy cables at retail. Cables have higher profit margins than almost everything except extended warranties. Despite what the marketing and sales people will tell you, there is no difference. Need a computer cable? Order it from a wholesaler online. That USB cable that your printer requires will cost you $25 at Staples and $1.50 at Newegg.</p>
</li>
<li>
<p>Never quote an entire post unless it's shorter than the one you write in response.</p>
</li>
<li>
<p>Don't eat food after 6pm.</p>
</li>
<li>
<p>In college, always check the library to see if the teacher is using a test bank.</p>
</li>
</ul>
</div>
</article><br><hr>
<br>
</div>
<div class="pagination">
<a href="index-16.html" rel="prev"></a>
<a class="pagination-item newer" href="index-16.html">Newer
</a><a class="pagination-item older" href="index-14.html">Older</a>
</div>
<footer class="site-footer" id="footer"><span> CC BY-SA 4.0 International.<br></span>
<span class="site-footer-credits"><a href="https://getnikola.com">Nikola</a>, <a href="https://github.com/jasonlong/cayman-theme">Cayman theme</a>.</span>
</footer></section>
</div>
</body>
</html>