aft 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3fe0209c8e20021c7a75434551cbff40ed3a0b72
4
- data.tar.gz: 8d7b9f8995e79ca8f6ee483c9a3fd1294b872e42
3
+ metadata.gz: 5d8663463d4ccd1e7704ea73bebe0e079714fa3f
4
+ data.tar.gz: 7e286cb418c121ecee8583433657083273c6b527
5
5
  SHA512:
6
- metadata.gz: 3a0c98fee19f443c781df7867359a5b0ff1858cc2bd418ca8c4274ab27fa799191ff43326b9b44ec527b46540b6c4a5303dccc76d594fe149009c5f1e93b1a14
7
- data.tar.gz: 0c44db3fd2d655bbd25eb88b08ad6baa69f1ec94c3efe8e8042f6c5b1863f64026de299facf9a7d144eb07636ab08670c754168bf8d8ddfd2f5f59af1fa2a68e
6
+ metadata.gz: a89f9deafb057c8da7750d5d8a0d81e35447705aac951e3eda7ad25098d6e04fad16363ab496d197269c7226255642eaf2d4652da1fd7049c0e719a19a6b1416
7
+ data.tar.gz: 1b51ba2fdbd5e7df9b7a4823bbd1e1ae2073b03b026b8bd322fc5948bd5270380cbcd49263553816d27dbd0d9785ae420c6a4cf8b3f83bfb8973a6b670c400fe
data/README.md CHANGED
@@ -1,14 +1,14 @@
1
- # Awesome File Share - *AFT*
1
+ # Awesome File Transfer - *AFT*
2
2
  ## Aft - simple and *quick* file sharing server
3
- Aft comes with a couple commands, `afserver`, `afclient`.
4
- Also included is `afduo`, the command with both the server and client built in.
3
+ The Aft gem contains `afserver`, `afclient`, and `afduo`.
4
+ `afduo` has both the server and client built in.
5
5
  AFT automatically uses Zlib to compress files for efficient transfers.
6
6
  ## Up and running in less than a minute!
7
7
  Note that ruby needs to be installed first.
8
8
 
9
- + Fire up your shell and type: `gem install aft`
9
+ + Fire up your shell and type: `sudo gem install aft` (on MacOS type `sudo gem install aft -n /usr/local/bin`)
10
10
  + Next, start the file share server: `afserver filetoshare`
11
- + Last, start the client on the receiving end: `afclient 10.0.0.23 filedownloaded`
11
+ + Last, start the client on the receiving end: `afclient 10.0.0.23 filetodownload`
12
12
 
13
13
  ##### Done!
14
14
  ## Can I install without ruby gems or root?
@@ -51,9 +51,8 @@ Usage:
51
51
  afclient 10.0.0.54 recieve.html
52
52
  ```
53
53
  ### What is afduo and how do I use it?
54
- `afduo` is the program that I made initially, before having the idea of making a ruby gem.
55
- It's slightly more complex to use than the gem, but it has the same functionality.
56
-
54
+ `afduo` is slightly more complex to use than the gem, but it has the same functionality.
55
+ With `afduo`, you just have to specify if you are the client or server with "-c", or "-s"
57
56
  `afduo --help` gives:
58
57
  ```bash
59
58
  Usage:
@@ -74,4 +73,4 @@ Usage:
74
73
  ### Contribute
75
74
  Feel free to send pull requests, suggestions, and issues to [wlib on github](https://github.com/wlib/aft)
76
75
 
77
- ##### Author : Daniel Ethridge
76
+ #### Author : Daniel Ethridge
@@ -17,8 +17,7 @@ if Args.include? '-h' || '--help'
17
17
  puts Help
18
18
  exit
19
19
  else
20
- puts "Starting client..."
20
+ puts "[*] Starting client..."
21
21
  receive()
22
- puts "[+] Downloaded"
23
22
  puts "Success!"
24
23
  end
@@ -15,7 +15,6 @@ if Args.include? '-h' || '--help'
15
15
  puts Help
16
16
  exit
17
17
  else
18
- puts "[+] Started server"
18
+ puts "[*] Starting server"
19
19
  send()
20
- puts "Sharing stopped!"
21
20
  end
data/bin/setup CHANGED
@@ -5,4 +5,15 @@ set -vx
5
5
 
6
6
  bundle install
7
7
 
8
- # Do any other automated setup that you need to do here
8
+ clear
9
+ printf "\tAFT installed successfully\n\n\
10
+ To use AFT as a server:\n\
11
+ \t$ afserver filetoshare.txt\n\
12
+ \t'afserver --help' for help\n\
13
+ To use AFT as a client:\n\
14
+ \t$ afclient [server IP] file.txt\n\
15
+ \t'afclient --help' for help\n\n\
16
+ Examples:\n\
17
+ \t\$afserver log.txt\n\
18
+ \t\$afclient 10.0.0.3\n\
19
+ \t\$afclient 79.93.20.168 download.dat\n"
@@ -11,9 +11,33 @@ module Afclient
11
11
  def receive()
12
12
  sock = TCPSocket.new("#{$SIP}", 1174)
13
13
  rdata = sock.read
14
+ Signal.trap("INT") {
15
+ puts "\n[*] Client Stopped"
16
+ exit
17
+ }
18
+ if rdata.nil?
19
+ puts "[-] Server not reached or responding"
20
+ exit
21
+ elsif ! rdata.nil?
22
+ puts "[+] Downloading..."
23
+ end
24
+ $Defaultfile = "aft.out"
25
+ i = 0
26
+ while File.exist?($Defaultfile)
27
+ if true
28
+ $Defaultfile = "aft#{i}.out"
29
+ i = i+1
30
+ end
31
+ end
32
+ if $RFile == $SIP
33
+ puts "[*] Filename not set, writing to #{$Defaultfile}"
34
+ $RFile = $Defaultfile
35
+ end
14
36
  rfile = File.open("#{$RFile}", 'w')
15
37
  rstream = decompress(rdata)
38
+ puts "[+] Decompressed data"
16
39
  rfile.write rstream
40
+ puts "[+] File transfer done"
17
41
  rfile.close
18
42
  end
19
43
  end
@@ -10,15 +10,31 @@ module Afserver
10
10
  end
11
11
  def send()
12
12
  server = TCPServer.new 1174
13
+ if $SFile.nil?
14
+ puts "[-] File not specified"
15
+ exit
16
+ end
17
+ puts "[+] Server online"
18
+ i = 0
19
+ if ! File.exist?($SFile)
20
+ puts "[-] File does not exist"
21
+ exit
22
+ end
13
23
  sfile = File.open("#{$SFile}", 'r')
14
24
  sstream = compress(sfile)
25
+ puts "[*] Serving compressed file : (#{sfile.size - sstream.size}) bytes smaller than original"
26
+ sfile.close
15
27
  while true
28
+ Signal.trap("INT") {
29
+ puts "\n[*] Server Stopped"
30
+ exit
31
+ }
16
32
  Thread.new(server.accept) do |client|
17
33
  puts "[+] Connection accepted from a client"
18
34
  client.write sstream
35
+ puts "[*] Sent file to client, ending connection"
19
36
  client.close
20
37
  end
21
38
  end
22
- sfile.close
23
39
  end
24
40
  end
@@ -1,3 +1,3 @@
1
1
  module Aft
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aft
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Ethridge
@@ -60,7 +60,6 @@ files:
60
60
  - lib/afclient.rb
61
61
  - lib/afserver.rb
62
62
  - lib/aft/version.rb
63
- - pkg/zds-1.0.0.gem
64
63
  homepage: https://github.com/wlib/aft
65
64
  licenses:
66
65
  - GPL-3.0
Binary file