tcpfiletransfer 0.0.4 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 62044c0e19afeac843809c334b214195b733a0f86117340612b4d456ea2c640a
4
- data.tar.gz: 748c80bd45a384b162c4cd426eb4b37b29d60a26381497540406328eba0f23d2
3
+ metadata.gz: e05f1f2443f8672ad35b72d470ebaee0c906cf686d9e94fb010757d1d62dcb42
4
+ data.tar.gz: af5dcbb81340ddc9794f94c64401adccaba2fe0d2c39666016adb01d979c6644
5
5
  SHA512:
6
- metadata.gz: bd0732e8a55145e4786b88984b1de03f4fe689538bae699d58dccd8b0326a0b57bda1798b3a40550786fe86a09534f81f58d44e6b2b30314714a6935a88d77a6
7
- data.tar.gz: 52fa15820ad722d1f472bfa0eb8fe3dff7b66e284fae7e2715e31c601177bc57cb0d7b60d4beecb838ef5cce2e7f37168a4431ef751fc805afbfa86b58c1a612
6
+ metadata.gz: adc96bd9d1709741b31603b6874f61028ccb92b032dc0b4351fc010c00974adeb0138d3ea0111c29c904225a711460f3673568ef156c93abed835ea846b4960b
7
+ data.tar.gz: bb99ab26bca1a85e3d760cbcc63a47f2fe1d6f3c41d8763c2f603d0b79762968f361bb472e0f7fb48c4be6167793220644c233d14675cf273f9ee80240ba745f
data/bin/sendfile CHANGED
@@ -10,13 +10,15 @@ name = originalpath.split("/").last.gsub(" ", "_")
10
10
 
11
11
  recipient = ""
12
12
  loop do
13
- recipient = ARGV[1] || `zenity --text="Recipient\\n(Leave blank to discover available recipients)" --entry --title='Send File'`.chomp
13
+ recipient = ARGV[1] || `zenity --text="Recipient\\n(Leave blank to search for available recipients)" --entry --title='Send File'`.chomp
14
14
  exit(1) if $?.exitstatus == 1
15
15
 
16
16
  if recipient == ""
17
- `notify-send 'Please wait, searching for recipients'`
18
- hosts = `nmap -Pn -p8021 --open 192.168.0.0/24 | grep -oP '([\\w-]+\\s\\(((25[0-5]|(2[0-4]|1\\d|[1-9]|)\\d)\\.?\\b){4}\\)|((25[0-5]|(2[0-4]|1\\d|[1-9]|)\\d)\\.?\\b){4})'`
19
- `zenity --info --no-wrap --title="Avalable recipients" --text="#{hosts}"`
17
+ `nmap -Pn -p8021 --open 192.168.0.0/24 | grep -oP '([\\w-]+\\s\\(((25[0-5]|(2[0-4]|1\\d|[1-9]|)\\d)\\.?\\b){4}\\)|((25[0-5]|(2[0-4]|1\\d|[1-9]|)\\d)\\.?\\b){4})' | tee ~/.tmphosts | zenity --progress --pulsate --no-cancel --text="Searcing for available devices" --title="Searching..." --auto-close`
18
+ hosts = File.read("#{Dir.home}/.tmphosts")
19
+ recipient = `zenity --list --title="Avalable recipients" --text="Choose a device" --column="Available Recipients" #{hosts.split("\n").map{|h|"'#{h}'"}.join(" ")}`.match(/((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}/).to_s
20
+ break if recipient != ""
21
+ exit(1) if $?.exitstatus == 1
20
22
  else
21
23
  break
22
24
  end
@@ -4,7 +4,10 @@ module FileTransfer
4
4
  path = initdata[1].split("/")
5
5
  decline = (path[2] == "decline")
6
6
  path = ?/ + path[1]
7
+ sock_domain, remote_port, remote_hostname, remote_ip = client.peeraddr
8
+
7
9
  if decline
10
+ `zenity --error --title="Transfer Declined" --text="Your transfer to #{remote_hostname} has been declined." --no-wrap`
8
11
  $active_transfers.delete(path)
9
12
  client.puts "HTTP/1.0 200\r\nContent-Type: text/plain\r\n\r\nTransfer declined"
10
13
  client.close
@@ -23,6 +26,8 @@ module FileTransfer
23
26
  client.close
24
27
  return
25
28
  end
29
+
30
+ `zenity --info --title="Transfer Accepted" --text="Your transfer to #{remote_hostname} has been accepted." --no-wrap`
26
31
  client.puts "HTTP/1.0 200\r\nContent-Type: application/octet-stream\r\nContent-Disposition: attachment; filename=\"#{file[:name]}\"\r\n\r\n#{File.read(file[:path])}"
27
32
  $active_transfers.delete(path)
28
33
  client.close
@@ -9,7 +9,7 @@ module FileTransfer
9
9
 
10
10
  x=system("zenity --question --icon-name=document-save-symbolic.symbolic --no-wrap --text=\"#{notification_body}\" --title='#{notification_title}'")
11
11
  if x
12
- file_location = `zenity --file-selection --save --filename=#{filename}`
12
+ file_location = `zenity --title="Save file" --file-selection --save --filename=#{filename.chomp}`.chomp
13
13
  if file_location == ""
14
14
  f=open(accept_link + "/decline")
15
15
  f.read
data/lib/filetransfer.rb CHANGED
@@ -5,7 +5,7 @@ module FileTransfer
5
5
  @@files = ['server.rb', 'notifier.rb', 'httpserver.rb', 'ftserver.rb']
6
6
 
7
7
  def self.version
8
- "0.0.4"
8
+ "0.0.6"
9
9
  end
10
10
 
11
11
  def self.file_paths(relative:false)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tcpfiletransfer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthias Lee
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-26 00:00:00.000000000 Z
11
+ date: 2023-03-27 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: An easy way to transfer files over TCP between linux computers
14
14
  email: matthias@matthiasclee.com