aft 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -9
- data/bin/afclient +1 -2
- data/bin/afserver +1 -2
- data/bin/setup +12 -1
- data/lib/afclient.rb +24 -0
- data/lib/afserver.rb +17 -1
- data/lib/aft/version.rb +1 -1
- metadata +1 -2
- data/pkg/zds-1.0.0.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d8663463d4ccd1e7704ea73bebe0e079714fa3f
|
4
|
+
data.tar.gz: 7e286cb418c121ecee8583433657083273c6b527
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a89f9deafb057c8da7750d5d8a0d81e35447705aac951e3eda7ad25098d6e04fad16363ab496d197269c7226255642eaf2d4652da1fd7049c0e719a19a6b1416
|
7
|
+
data.tar.gz: 1b51ba2fdbd5e7df9b7a4823bbd1e1ae2073b03b026b8bd322fc5948bd5270380cbcd49263553816d27dbd0d9785ae420c6a4cf8b3f83bfb8973a6b670c400fe
|
data/README.md
CHANGED
@@ -1,14 +1,14 @@
|
|
1
|
-
# Awesome File
|
1
|
+
# Awesome File Transfer - *AFT*
|
2
2
|
## Aft - simple and *quick* file sharing server
|
3
|
-
Aft
|
4
|
-
|
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
|
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
|
55
|
-
|
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
|
-
|
76
|
+
#### Author : Daniel Ethridge
|
data/bin/afclient
CHANGED
data/bin/afserver
CHANGED
data/bin/setup
CHANGED
@@ -5,4 +5,15 @@ set -vx
|
|
5
5
|
|
6
6
|
bundle install
|
7
7
|
|
8
|
-
|
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"
|
data/lib/afclient.rb
CHANGED
@@ -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
|
data/lib/afserver.rb
CHANGED
@@ -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
|
data/lib/aft/version.rb
CHANGED
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.
|
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
|
data/pkg/zds-1.0.0.gem
DELETED
Binary file
|