Page 1 of 1
ynetshares-0.9 - yad gui to mount network shares
Posted: Sun Jan 21, 2024 8:48 pm
by plinej
Here's a simple yad gui for mounting/unmounting network shares. You will need yad, nmap, and smbclient installed to use this. Run the gui from the network menu and it will scan your network for any shares. If shares are found you'll be able to select what you'd like to mount. If you successfully mount a share you'll be prompted to unmount when you run the program again.
- ynetshares.png (12.72 KiB) Viewed 1046 times
0.2 minor improvements
0.3 added option to rescan and if arp is installed the first, third, fifth, etc... rescan will use arp instead of nmap to find local ip addresses. I also added a yad tail viewer that will display smbclient checking the found ip addresses for shares.
0.4 I decided to speed the process. When initially searching for shares the program will try to ping your existing saved shares and if online you will be prompted to mount them. If you select rescan then nmap will run and search for all local ip addresses like normal. I'm guessing most people are like me and really only mount the same network share/shares so there's no need to run nmap every time.
0.5 used mktemp for the temp file and fixed a couple of commands that might print errors. I also edited a few of the buttons.
0.6 sped up some processes and created a manual entry option
0.7 added option to re-scan all IP addresses without host names for shares
0.8 the program will unmount a mounted network drive when the host is down
0.9 bugfix
Re: ynetshares-0.2 - yad gui to mount network shares
Posted: Mon Jan 22, 2024 9:14 pm
by plinej
Re: ynetshares-0.3 - yad gui to mount network shares
Posted: Sat Feb 10, 2024 12:19 pm
by plinej
Re: ynetshares-0.4 - yad gui to mount network shares
Posted: Sat Feb 10, 2024 7:16 pm
by plinej
Re: ynetshares-0.4 - yad gui to mount network shares
Posted: Sat Feb 10, 2024 8:15 pm
by user1234
Running the program, I get:
Code: Select all
cat: /root/.ynetshares: No such file or directory
You should add a check at the beginning whether the file is present or not, or even better, simply do:
EDIT: I see why you may not want to simply touch the file. So, adding a check is a choice; the error occurs at line 159 (since cat is used without a check).
Another thing, you use user and timestamps to generate temporary file, which is not secure. Use the command mktemp
instead.
The command also creates the temporary file, so it is secure against race conditions.
Re: ynetshares-0.5 - yad gui to mount network shares
Posted: Sat Feb 10, 2024 9:21 pm
by plinej
@user1234, thanks for your input. I've posted version 0.5.
Re: ynetshares-0.5 - yad gui to mount network shares
Posted: Sun Feb 11, 2024 6:24 am
by user1234
@plinej, I also was not able to get this working in Jammy64 running in QEMU environment. I can access my samba service if I manually connect to my service with these commands:
Code: Select all
sambashare //192.168.205.204/sambashare -U=lakshay
Code: Select all
mount -t cifs //192.168.205.204/sambashare ./sambashare -o user=lakshay
But, ynetshares only returns with "No shares found".
My IP address in QEMU: 10.0.2.15
.
Maybe, it is because my QEMU and my Host are not in the same local network?
However, QEMU does not have a separate network connection.
Here is ifconfig
's output from (i) Host:
Code: Select all
enp1s0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether b4:b6:86:df:50:a7 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 23372 bytes 2444837 (2.4 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 23372 bytes 2444837 (2.4 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
ether 52:54:00:2b:a0:b6 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlp2s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.205.204 netmask 255.255.255.0 broadcast 192.168.205.255
inet6 fe80::69a7:c5c9:2473:afba prefixlen 64 scopeid 0x20<link>
inet6 2402:3a80:41c2:2e73:2df9:2806:80d4:21a2 prefixlen 64 scopeid 0x0<global>
inet6 2402:3a80:41c2:2e73:c074:9f3c:1d96:5988 prefixlen 64 scopeid 0x0<global>
ether 94:b8:6d:6e:31:74 txqueuelen 1000 (Ethernet)
RX packets 24112 bytes 15727492 (15.7 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 76121 bytes 8155872 (8.1 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
(Here, wlp2s0 is my running network device.)
(ii) QEMU:
Code: Select all
ens3 Link encap:Ethernet HWaddr 52:54:00:12:34:56
inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0
inet6 addr: fec0::bcc6:2e89:397b:5f4a/64 Scope:Site
inet6 addr: fe80::5054:ff:fe12:3456/64 Scope:Link
inet6 addr: fec0::5054:ff:fe12:3456/64 Scope:Site
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:453 errors:0 dropped:0 overruns:0 frame:0
TX packets:441 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:57092 (55.7 KiB) TX bytes:42274 (41.2 KiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
(Here, ens3 is my running network device.)
Re: ynetshares-0.5 - yad gui to mount network shares
Posted: Sun Feb 11, 2024 2:30 pm
by plinej
@user1234, yes it's because it's not in the same local network. I've never used QEMU but I assume you'd need to find the IP address on your Host device and then manually connect. I could add a manual configuration option that could be saved and edited if/when the local IP address changes.
Re: ynetshares-0.6 - yad gui to mount network shares
Posted: Sun Feb 11, 2024 5:24 pm
by plinej
Re: ynetshares-0.7 - yad gui to mount network shares
Posted: Wed Mar 13, 2024 9:45 pm
by plinej
Re: ynetshares-0.8 - yad gui to mount network shares
Posted: Wed Mar 27, 2024 12:27 pm
by plinej
Re: ynetshares-0.8 - yad gui to mount network shares
Posted: Wed Mar 27, 2024 1:05 pm
by Clarity
Hello @user1234 and @plinej
QEMU accesses the host's sharelist over IP 10.0.2.2. File/folder movement can occur between the host and the VM via mount or samba services. For example, via the command smbclient -U% -L 10.0.2.2
Of course, the host MUST have its SAMBA started.
For ynetshare could detect if it is being used in a QEMU VM by a filesystem search. For example this shows
- neofetch.jpg (31.99 KiB) Viewed 1064 times
@plinej would you be willing to put a sample screenshot of the ynetshare GUI in your opening post of this thread?
Enjoy
Re: ynetshares-0.9 - yad gui to mount network shares
Posted: Wed Mar 27, 2024 5:45 pm
by plinej
0.9 is up. I found a bug and fixed it.