from Hacker News

Show HN: Transfer files to mobile device by scanning a QR code from the terminal

by daw___ on 3/22/18, 12:26 PM with 72 comments

  • by paulgb on 3/22/18, 5:41 PM

    Nice! (Shameless plug follows) I use a similar technique in the notify-run Python package for setting up push notifications to an Android device from Python: https://github.com/paulgb/notify.run/blob/master/py_client/R...
  • by daw___ on 3/22/18, 12:28 PM

    From the README:

    This program binds a web server to the address of your wifi network interface on a random port, and sets a default handler for it. The default handler serves the content and quits the program when the transfer is complete.

    The program prints a QR code that encodes the text:

    http://{address}:{port}

    Most QR apps can detect URLs in decoded text and act accordingly (i.e.: open the URL with the default browser), so when QR the code is scanned the content starts being downloaded by the mobile browser.

  • by ktpsns on 3/22/18, 3:20 PM

    An innovative idea, I like it and could think of using it. Actually it would be more helpful if there was a way to transfer multiple files in a reasonable manner. While the server implementation would be trivial, the mass downloading client on the mobile phone is obviously the tricky part. Effective file managament on the mobile phone is even bad on Android, in my experience.
  • by kureikain on 3/22/18, 4:42 PM

    This is amazing. Always looking for something like this. The old way I used to do is to run a HTTP server with an upload form in the mobile phone. But this requires an app on phone to run that server.

    The idea of QR code is amazing. I'll put this to my news letter next week. Look out for it

  • by ryanmarsh on 3/22/18, 8:13 PM

    I’ve experimented with this for a while. My clients often have very locked down windows laptops but they oddly allow hand typed powershell scripts to run.

    If you “play” a series of qr codes with checksums and record them from a phone and process the video on the phone you can exfil data without tripping any IDS.

    Opening a port often requires privileges or can at least trip an IDS. Silly really.

  • by jonplackett on 3/22/18, 8:37 PM

    Really smart. Was also worried it would be tranfered via some random web server but it’s a really elegant solution. Well done!
  • by yoz-y on 3/22/18, 5:48 PM

    Looks useful and fun, however it does not seem to work correctly with ipv6 on mac? I obtain:

        2018/03/22 18:46:55 listen tcp: address fe80::XX:XXXX:XXX:XXXX:57532: too many colons in address
  • by spieglt on 3/23/18, 4:54 AM

    Great project! I'm working on one that's somewhat related, it's basically cross-platform AirDrop (though only for laptops). Seems like mine could really benefit from a method of getting files to phones like this, and yours could benefit from not needing a wireless network like Flying Carpet. http://github.com/spieglt/flyingcarpet
  • by andmarios on 3/23/18, 1:07 AM

    Here is a small issue: https://github.com/claudiodangelis/qr-filetransfer/blob/mast...

    I don't know if it is the barcode scanner app (I use the one from zxing, a very popular choice), or the Android implementation (LG, Android 7), but here is a description of what happens:

    As soon as I scan the barcode, it is copied to the clipboard. Then something goes to check if the URL is working (the barcode app? android clipboard? not sure). Since you exit after the first request, my browser never gets the chance to download the file. If I remove the os.Exit(), I get it working (and then terminate qr-filetransfer via ctrl+c).

    Anyhow, very nice work. Kudos!

  • by kamil9 on 3/22/18, 9:21 PM

    did something similar with features like upload,view files before download and file creation time (shameless plug :P ) https://github.com/kamilkabir9/LDrop
  • by daw___ on 3/22/18, 6:06 PM

  • by dyarosla on 3/22/18, 6:03 PM

    Looks like a cool project! Only quickly glanced at the code but couldn’t find it: where does this transfer files to on an iOS device? Does it even work with iOS?
  • by fiatjaf on 3/22/18, 10:15 PM

    Doesn't work here. As soon as I scan the QR code with my phone, I'm prompted by the barcode-scanner app to open the URL (192.168.15.whatever) on the browser, but at the time this happens qr-filetransfer is already closed and not listening anymore, it has closed immediately when the QR code was read.

    How does it happen I cannot know.

  • by laurent123456 on 3/22/18, 5:23 PM

    That's pretty cool. I wonder if it could be adapted to use something like Nextcloud to avoid the requirement of being on the same wifi.

    The workflow would be something like: Upload to Nextcloud (it would need to ask username/password) => Get Nextcloud URL (eg via WebDAV) => Create QR code.

  • by eudoxus on 3/23/18, 2:31 AM

    How is this not called qrcp? :/
  • by throw501 on 3/22/18, 7:09 PM

    nice, thanks.

    would be nice if it could allow pipes. example to send the clipboard:

    $ pbpaste | qr-filetransfer 2018/03/22 15:06:48 At least one argument is required

  • by kodejuice on 3/27/18, 8:56 AM

    Very similar to the eay Expo works
  • by kodejuice on 3/27/18, 8:55 AM

    Very similar to the way Expo works
  • by thrownaway954 on 3/22/18, 4:03 PM

    awesome project