Skip to content

Commit

Permalink
Merge d78953a into 9be9b10
Browse files Browse the repository at this point in the history
  • Loading branch information
lmammino committed Jul 29, 2019
2 parents 9be9b10 + d78953a commit 87d7fd3
Show file tree
Hide file tree
Showing 30 changed files with 7,625 additions and 731 deletions.
5 changes: 5 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Set the default behavior, in case people don't have core.autocrlf set
* text=auto

# Require Unix line endings
* text eol=lf
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ coverage
# nyc test coverage
.nyc_output

# extra coverage files
junit-testresults.xml
out.tap

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

Expand Down Expand Up @@ -86,3 +90,5 @@ typings/

# DynamoDB Local files
.dynamodb/

received-files/
97 changes: 97 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# extra coverage files
junit-testresults.xml
out.tap

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# next.js build output
.next

# nuxt.js build output
.nuxt

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

received-files/
logo/
*.test.js
src/tests_coverage_map.js
44 changes: 42 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,45 @@
# filerec
<p align="center">
<img src="/logo/filerec.svg" alt="Filerec logo"/>
</p>

Easily spin up a local http server to accept files from your lan
<p align="center"><strong>Local HTTP 1.1 server to securely receive files from friends and colleagues on the local network.</strong></p>

<p align="center">
<a href="https://dev.azure.com/loige/loige/_build/latest"><img alt="Build Status" src="https://dev.azure.com/loige/loige/_apis/build/status/lmammino.filerec"/></a>
<a href=""></a>
<a href="https://badge.fury.io/js/filrerec"><img src="https://badge.fury.io/js/filrerec.svg" alt="npm version"></a>
<a href="https://coveralls.io/github/lmammino/filrerec"><img src="https://coveralls.io/repos/github/lmammino/filrerec/badge.svg" alt="Coverage Status"></a>
</p>

...


## Send a file with curl (encrypted)

```bash
FILENAME="/some/file" # change this
SERVER="http://localhost:12345" # change this

# get server public key
SERVER_KEY="/tmp/filrerec-key-$(date +%s).pem"
curl "${SERVER}/key" > "${SERVER_KEY}"

# generate random symmetric key and initialization vector
KEY=$(openssl rand -hex 32)
IV=$(openssl rand 16)
IV_B64=$(echo -ne "${IV}" | base64)
IV_HEX=$(echo -ne "${IV}" | xxd -ps)

# encrypt the key with server public key
SEALED_KEY=$(echo -ne "${KEY}" | openssl rsautl -encrypt -oaep -pubin -inkey ${SERVER_KEY} | base64)

# encrypt the file and send it with curl
openssl enc -e -aes-256-cbc -nosalt -iv "${IV_HEX}" -K "${KEY}" -in "${FILENAME}" | \
curl -XPOST \
--data-binary @- \
-H "Content-Type: application/octet-stream" \
-H "X-Sealed-Key: ${SEALED_KEY}" \
-H "X-Encryption-IV: ${IV_B64}" \
-H "X-Filename: ${FILENAME}" \
"${SERVER}/file"
```
42 changes: 42 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
trigger:
- master

pool:
vmImage: 'ubuntu-latest'

strategy:
matrix:
node_12_x:
node_version: 12.x
node_11_x:
node_version: 11.x

steps:
- task: NodeTool@0
inputs:
versionSpec: $(node_version)
displayName: 'Install Node.js'

- script: |
npm install
displayName: 'Install dependencies'

- script: |
npm test
env:
COVERALLS_REPO_TOKEN: $(coveralls.token)
displayName: 'Run tests'

- task: PublishTestResults@2
displayName: "Publish Test Results"
condition: succeededOrFailed()
inputs:
testResultsFiles: "$(System.DefaultWorkingDirectory)/junit-testresults.xml"
testRunTitle: TestRun Filerec on $(node_version)

- task: PublishCodeCoverageResults@1
displayName: "Publish code coverage results"
condition: succeededOrFailed()
inputs:
codeCoverageTool: "Cobertura"
summaryFileLocation: "$(System.DefaultWorkingDirectory)/coverage/cobertura-coverage.xml"
Binary file added logo/favicon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added logo/filerec.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added logo/filerec.sketch
Binary file not shown.
1 change: 1 addition & 0 deletions logo/filerec.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 87d7fd3

Please sign in to comment.