Friday, October 1, 2021

Recent Questions - Unix & Linux Stack Exchange

Recent Questions - Unix & Linux Stack Exchange


Custom USB HID device keeps disconnecting and reconneting

Posted: 01 Oct 2021 10:23 AM PDT

I have a little home-made measurement device, which outputs it data by USB HID to a connected computer. It works fine under Windows, but under Linux (I tested it on two different computers, both a recent Debian) it just connects for a few seconds, then disconnects and immediately reconnects, and so on.

Extract out of the syslog:

Oct  1 17:17:26 r2 kernel: [20446.158839] usb 1-6: USB disconnect, device number 76  Oct  1 17:17:27 r2 kernel: [20446.804678] usb 1-6: new low-speed USB device number 77 using xhci_hcd  Oct  1 17:17:27 r2 kernel: [20446.963314] usb 1-6: New USB device found, idVendor=16c0, idProduct=05df, bcdDevice= 1.00  Oct  1 17:17:27 r2 kernel: [20446.963317] usb 1-6: New USB device strings: Mfr=1, Product=2, SerialNumber=3  Oct  1 17:17:27 r2 kernel: [20446.963318] usb 1-6: Product: Miniskop 1.3  Oct  1 17:17:27 r2 kernel: [20446.963319] usb 1-6: Manufacturer: obdev.at  Oct  1 17:17:27 r2 mtp-probe: checking bus 1, device 77: "/sys/devices/pci0000:00/0000:00:14.0/usb1/1-6"  Oct  1 17:17:27 r2 mtp-probe: bus: 1, device: 77 was not an MTP device  Oct  1 17:17:27 r2 kernel: [20446.970031] input: obdev.at Miniskop 1.3 as /devices/pci0000:00/0000:00:14.0/usb1/1-6/1-6:1.0/0003:16C0:05DF.02B3/input/input704  Oct  1 17:17:27 r2 kernel: [20446.970203] hid-generic 0003:16C0:05DF.02B3: input,hidraw4: USB HID v1.01 Device [obdev.at Miniskop 1.3] on usb-0000:00:14.0-6/input0  Oct  1 17:17:27 r2 mtp-probe: checking bus 1, device 77: "/sys/devices/pci0000:00/0000:00:14.0/usb1/1-6"  Oct  1 17:17:27 r2 mtp-probe: bus: 1, device: 77 was not an MTP device  Oct  1 17:17:31 r2 kernel: [20451.406128] usb 1-6: USB disconnect, device number 77  Oct  1 17:17:32 r2 kernel: [20452.048706] usb 1-6: new low-speed USB device number 78 using xhci_hcd  Oct  1 17:17:32 r2 kernel: [20452.207314] usb 1-6: New USB device found, idVendor=16c0, idProduct=05df, bcdDevice= 1.00  Oct  1 17:17:32 r2 kernel: [20452.207317] usb 1-6: New USB device strings: Mfr=1, Product=2, SerialNumber=3  Oct  1 17:17:32 r2 kernel: [20452.207319] usb 1-6: Product: Miniskop 1.3  Oct  1 17:17:32 r2 kernel: [20452.207320] usb 1-6: Manufacturer: obdev.at  Oct  1 17:17:32 r2 mtp-probe: checking bus 1, device 78: "/sys/devices/pci0000:00/0000:00:14.0/usb1/1-6"  Oct  1 17:17:32 r2 mtp-probe: bus: 1, device: 78 was not an MTP device  Oct  1 17:17:32 r2 kernel: [20452.214050] input: obdev.at Miniskop 1.3 as /devices/pci0000:00/0000:00:14.0/usb1/1-6/1-6:1.0/0003:16C0:05DF.02B4/input/input705  Oct  1 17:17:32 r2 kernel: [20452.214127] hid-generic 0003:16C0:05DF.02B4: input,hidraw4: USB HID v1.01 Device [obdev.at Miniskop 1.3] on usb-0000:00:14.0-6/input0  Oct  1 17:17:32 r2 mtp-probe: checking bus 1, device 78: "/sys/devices/pci0000:00/0000:00:14.0/usb1/1-6"  Oct  1 17:17:32 r2 mtp-probe: bus: 1, device: 78 was not an MTP device  Oct  1 17:17:36 r2 kernel: [20456.638943] usb 1-6: USB disconnect, device number 78  Oct  1 17:17:37 r2 kernel: [20457.288758] usb 1-6: new low-speed USB device number 79 using xhci_hcd  Oct  1 17:17:37 r2 kernel: [20457.451322] usb 1-6: New USB device found, idVendor=16c0, idProduct=05df, bcdDevice= 1.00  Oct  1 17:17:37 r2 kernel: [20457.451325] usb 1-6: New USB device strings: Mfr=1, Product=2, SerialNumber=3  Oct  1 17:17:37 r2 kernel: [20457.451326] usb 1-6: Product: Miniskop 1.3  Oct  1 17:17:37 r2 kernel: [20457.451327] usb 1-6: Manufacturer: obdev.at  Oct  1 17:17:37 r2 mtp-probe: checking bus 1, device 79: "/sys/devices/pci0000:00/0000:00:14.0/usb1/1-6"  Oct  1 17:17:37 r2 mtp-probe: bus: 1, device: 79 was not an MTP device  Oct  1 17:17:37 r2 kernel: [20457.458007] input: obdev.at Miniskop 1.3 as /devices/pci0000:00/0000:00:14.0/usb1/1-6/1-6:1.0/0003:16C0:05DF.02B5/input/input706  Oct  1 17:17:37 r2 kernel: [20457.458060] hid-generic 0003:16C0:05DF.02B5: input,hidraw4: USB HID v1.01 Device [obdev.at Miniskop 1.3] on usb-0000:00:14.0-6/input0  Oct  1 17:17:37 r2 mtp-probe: checking bus 1, device 79: "/sys/devices/pci0000:00/0000:00:14.0/usb1/1-6"  Oct  1 17:17:37 r2 mtp-probe: bus: 1, device: 79 was not an MTP device    

I found this very similar looking question about the same behavior of an UPS, but I don't know how (if even possible) to adapt it to my problem.

Silent option for read gets ignored?

Posted: 01 Oct 2021 10:18 AM PDT

I run a loop in a bash shell script until a key is pressed (Ctrl-C always seems cruel to me). Although I use the -s option for read, the single character is shown in the terminal. Why does the -s option for read not do what I expect!

until read -s -n 1 -t 0.01; do       echo -n "."      sleep .5      done   echo   

Ansible-Galaxy install from tarball stuck on establishing connection to galaxy.ansible.com

Posted: 01 Oct 2021 10:32 AM PDT

I'm trying to install an ansible collection via ansible-galaxy. However, the programm is stuck during the step Initial connection to galaxy_server: https://galaxy.ansible.com and I have no idea what the problem could be. Thinking there might be a problem with the connection to the server, I manually downloaded and supplied the collection as tarball. However, that does not change anything. Any ideas what I might be missing?

ansible-galaxy collection install ~/Download/ansible.posix-1.3.0.tar.gz -vvvv  ansible-galaxy 2.5.1    config file = /home/philipp/.ansible.cfg    configured module search path = [u'/home/philipp/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']    ansible python module location = /usr/lib/python2.7/dist-packages/ansible    executable location = /usr/bin/ansible-galaxy    python version = 2.7.17 (default, Feb 27 2021, 15:10:58) [GCC 7.5.0]  Using /home/philipp/.ansible.cfg as config file  Opened /home/philipp/.ansible_galaxy  Processing role collection   Opened /home/philipp/.ansible_galaxy  Initial connection to galaxy_server: https://galaxy.ansible.com  

Update

Apparently, it isn't stuck, but super slow. While typing the question the program continued.

ansible-galaxy 2.5.1    config file = /home/philipp/.ansible.cfg    configured module search path = [u'/home/philipp/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']    ansible python module location = /usr/lib/python2.7/dist-packages/ansible    executable location = /usr/bin/ansible-galaxy    python version = 2.7.17 (default, Feb 27 2021, 15:10:58) [GCC 7.5.0]  Using /home/philipp/.ansible.cfg as config file  Opened /home/philipp/.ansible_galaxy  Processing role collection   Opened /home/philipp/.ansible_galaxy  Initial connection to galaxy_server: https://galaxy.ansible.com  Base API: https://galaxy.ansible.com/api/v1  - downloading role 'collection', owned by   https://galaxy.ansible.com/api/v1/roles/?owner__username=&name=collection   [WARNING]: - collection was NOT installed successfully: Content has no field named 'owner'    ERROR! - you can use --ignore-errors to skip failed roles and finish processing the list.  

extract fields based on a string (partial and exact)

Posted: 01 Oct 2021 10:14 AM PDT

Expertos: I want to extract fields based on a string (partial and exact). In some rows these fields are moved one or two columns, so I can't specify the column (which is the extent of my knowledge). I also need to extract the 1st, 2nd, 4th and 5th fields, but those don't vary row to row, so I can do that myself.

Specifically, I want to extract the field having the partial string "DP4=" and the field with a matching string like "MODERATE" plus the field to the left and right:

input:

NW_006532014.1  603822  .       T       C       222.0   .       DP=103  ADF=30,22       ADR=13,16       AD=43,38        VDB=0.0570121   SGB=-0.693143   RPB=0.810487    MQB=0.570226    MQSB=0.033126   BQB=0.964281    MQ0F=0  ICB=1    HOB=0.5 AC=1    AN=2    DP4=30,13,22,16 MQ=35   ANN=C   missense_variant        MODERATE        ABCB6   ABCB6   transcript      XM_007419806.2  

desired output (tab-delim):

DP4=30,13,22,16 missense_variant MODERATE ABCB6  

Thanks!

How to make Linux bridge act as a hub instead of a virtual switch?

Posted: 01 Oct 2021 10:07 AM PDT

I'm using virt-manager and qemu to run virtual machines. I had a task I needed to complete that involved sniffing traffic from another VM from a Kali Linux VM. Because the bridge network acts as a switch, this was not possible (as it is in VMWare's "promiscuous mode"). I found this tutorial online: https://techglimpse.com/convert-linux-bridge-hub-vm-interospection/

This states that you can use brctl to change some settings of the bridge to make it act like a hub instead of a switch (and forward all frames to all hosts in the virtual network).

I ran the following commands after the bridge started, as shown in the article:

brctl stp virbr0 off  brctl setageing virbr0 0  brctl setfd virbr0 0  

Then, I opened up Wireshark on Kali, with the virtual NIC in promiscuous mode. Then, in a separate VM, I ran ping 8.8.8.8.

When I went back to the Kali VM and attempted to view the network traffic, I could see the ICMP echo replies from 8.8.8.8, but I could not see the echo requests from the virtual machine.

I opened up a web browser on the virtual machine and navigated around, again I can only see packets destined to the VM, not packets that originated from it.

I'm guessing this is because the default gateway in the virbr0 interace is somehow being sent the packets directly, and they aren't being forwarded out to every interface.

Is there something else I can do to resolve this issue? I read about Open Vswitch, is there a way to use this or some other software to create a hub-like virtual network?

Best approach to internally load-balance tcp flows to dummy interfaces for traffic capture?

Posted: 01 Oct 2021 10:01 AM PDT

Background - I would like to horizontally scale a packet capture and analysis tool running on a Linux appliance. The capture uses two processes to capture and process the captured traffic. The raw capture is multithreaded and is attached to a physical (or virtual) interface. The metadata extraction process is single-threaded. The rate determining step of the whole thing is the single-threaded process.

My idea is to split the traffic captured on the external interface to N internal dummy interfaces and spawn a new extraction process in parallel for each of them. Where N is derived from how many cores the capture device has.

I need TCP flows to be consistently sent to one interface to capture and be able to extract correct metadata (as it is stateful).

So, I need to load-balance TCP flows seen on the capture interface in a deterministic to the dummy interfaces.

This is all complicated by the fact the traffic I am handling is entirely unrelated to the host (in terms of L2 and L3 paths) and I don't want to change it send it externally.

I am looking at:

  1. iptables -t mangle with CONNMARK and RESTOREMARK, allowing me to mark discrete flows.
  2. Then I use iptables -t mangle ... -m statistic --mode nth
  3. <some key step here that I cannot figure out>
  4. Then some kind of postrouting forwarding iptables -A POSTROUTING -o dummyN -j CONNMARK
  5. Then I was thinking to route the marked flows to one of the N dummy interfaces using new iproute2 tables in /etc/iproute2/rt_tables and ip rule add fwmark X table <tablename>

I don't care about return paths. I only want the traffic to hit the dummy interface and then it can be blackholed, as it's only destined for capture and analysis).

The traffic hitting the external capture interface could be anything - with any source or destination IP or Port (but limited to UDP or TCP). The IPs could be Public or private RFC1918 addresses which I don't want to change so I cannot use NAT.

For step 3 from the list above, I am a bit stuck:

  • I don't think I can change anything in the packet (at least not DST IP) or will impact my analysis. (Maybe DST MAC?)
  • I don't want to have to give my dummy interfaces real addresses as the addresses in the captured traffic may overlap and cause problems

What I really want is to just move packets from marked flows from one interface to another.

Should I try ebtables and rewrite the dst MAC to that of the dummy interface? Can I do this based on the iptables CONNMARK?

I realised that I am trying to make L2 decisions based on L4 information which makes me uneasy, but I will be discarding all traffic on the interfaces after capture.

Normally, I write out a problem like this for public consumption and as I write it out, it all becomes clear.

This time no luck so far.

Any ideas or suggestions? Am I missing something really obvious?

Should I be looking at doing this properly with eBPF and XDP? (I am planning on this route later, but wanted a quick workaround for scaling reasons).

Thank you in advance

Is it possible to block website through system Linux firewall for browser that used DNS over HTTPS?

Posted: 01 Oct 2021 09:53 AM PDT

OS: Fedora 34

Browser: Mozilla Firefox with DoH enabled

I'm trying to block website through core Linux settings (not web browser extension etc). Problem is inside DoH that I'm using. If I disable DoH, then all works perfectly with settings inside hosts

  # vi /etc/hosts      0.0.0.0 www.facebook.com    

I was trying to edit iptables but that doesn't work too

  # iptables -A OUTPUT -p tcp -d www.facebook.com --dport 443 -j DROP    # service iptables save    # service iptables restart    # iptables -L    

As I understood it is impossible at system level to block my access to web addr?

Package 'wicd' has no installation candidate

Posted: 01 Oct 2021 09:18 AM PDT

i want to install "wicd" in Kali but i Recive this Eror: E: Package 'wicd' has no installation candidate

I'm new in Linux

Gnuplot: What is the difference between plot '/dev/stdin' and plot '-'?

Posted: 01 Oct 2021 09:34 AM PDT

When I use '-' to plot in gnuplot from a pipeline, as follows:

$ seq 5 | gnuplot -e "plot '-' w lp; pause 99"  

it works fine, I can adjust the plot's window size, can show/hide grid without any problem.

But when I use '/dev/stdin' as follows:

$ seq 5 | gnuplot -e "plot '/dev/stdin' w lp; pause 99"  

It shows the plot but when I click to maximize the window, it crashes:

line 0: warning: Skipping data file with no valid points    plot '/dev/stdin' w lp                        ^  line 0: x range is invalid  

Could you please explain why does this happen? what is the difference between '-' and '/dev/stdin'?


⭐ I am deliberately using pause instead of using -p option, because the latter doesn't allow interaction with the plot (no update after resize, can't show/hide grid from the toolbar,etc.)
👉️ I am using bash version 5.0.17 on Ubuntu 20.04, gnuplot 5.2 patchlevel 8, if that info is needed.

Sharing ssh keys between cluster nodes

Posted: 01 Oct 2021 08:56 AM PDT

I have a cluster with several login nodes and many compute nodes (call it the cluster). Then I have another server with a large shared storage (call it the storage). I need to be able to rsync (i.e. ssh) from any node on the cluster to the storage. For that, I generated a private-public key pair on one of the headnodes of the cluster and registered that key with the storage.

At first, ssh-ing prompts for the password but any subsequent ssh works without the password. However, if I switch hosts on cluster (for example, landing on a different login node or ssh-ing from one of the compute nodes), then storage asks for the password again. Subsequent ssh connections from the same cluster host work, but the moment I switch hosts, the password is prompted again one more time.

I was wondering whether this could be a security setting on storage or there is anything specific to be done when sharing the same keys between multiple nodes to prevent this happening? I don't have root access to either cluster or storage and I cannot decide which nodes on cluster are assigned to me at runtime.

I believe my question is related to this one because my home directory (where the keys are located) is remotely mounted on the cluster nodes.

TMUX not supporting some of fish shell features

Posted: 01 Oct 2021 08:53 AM PDT

I've installed TMUX and I'm using fish shell. My fish shell shows available commands with a different color and there is autocomplete suggestion when I type in a command. I can't get to these features to work on TMUX. My problem is exactly as described here. However I don't think the problem is with TMUX not being able to detect number of colors. Running tput colors gives me 256 on both original fish and TMUX. I also have configured my ~/.tmux.conf with:

set-option -s default-terminal "tmux-256color"

which also didn't help. At this point I'm not sure how to debug tmux or where to look at for potential problems. any suggestions?

Keyboard doesn't work after driver reinstall

Posted: 01 Oct 2021 08:25 AM PDT

I reinstalled nvidia-driver(470.57.02-2) and after that keyboard stopped working in Xserver, I can't switch to other terminals. To fix this I tried reinstalling xserver-xorg-input-all and nvidia-driver, I even fully purged all xserver related packets and reinstalled them back.

/var/log/Xorg.0.log
/etc/X11/xorg.conf

After reinstalling each packet from xserver-xorg-input, I managed to enable touchpad, but keyboard and mouse still don't work.
My distro is debian/sid, current kernel: 5.10.0-8-amd64

How to open a filtered port

Posted: 01 Oct 2021 09:35 AM PDT

Somehow I keep breaking ssh on my ubuntu servers and I can't figure out why. I have a ddns set up as myserver.asuscomm.com and the ports are forwarded on my router. One of them works perfectly, but the other two show the ports as filtered when I connect from ddns. When I connect from the same network the ports are open.

Could this be some setting on my router that's wrong? Say the ssh port is 1234. netstat -tlpn shows that sshd is listening on this port and i have it to allow traffic from anywhere if i run sudo ufw status.

From the same network:

nmap -Pn -p 1234 192.168.50.x  Starting Nmap 7.80 ( https://nmap.org ) at 2021-10-01 10:13 CDT  Nmap scan report for 192.168.50.x  Host is up (0.00075s latency).    PORT      STATE SERVICE  1234/tcp open  optohost003    Nmap done: 1 IP address (1 host up) scanned in 0.13 seconds  

From the ddns off network:

nmap -p 1234 myserver.asuscomm.com  Starting Nmap 7.80 ( https://nmap.org ) at 2021-10-01 10:14 CDT  Nmap scan report for myserver.asuscomm.com (x.y.z.123)  Host is up (0.025s latency).  rDNS record for x.y.z.123: c-x-y-z-123.abc.state.isp.net    PORT      STATE    SERVICE  1234/tcp filtered optohost003    Nmap done: 1 IP address (1 host up) scanned in 0.46 seconds  

For this specific server it also says it's down when i do standard nmap so I have to add -Pn flag. The other server has the same issue but nmap can see it without -Pn.

Does anyone have ideas of how I can troubleshoot this? The ports are all forwarded on my Asus router and I can't figure out what other settings I could change. Should I try ssh on a different port?


Edit: output of netstat -nlp (port 22100 is my ssh)

tcp        0      0 127.0.0.1:32401         0.0.0.0:*               LISTEN      -  tcp        0      0 0.0.0.0:22100           0.0.0.0:*               LISTEN      -  tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      -  tcp        0      0 127.0.0.1:32600         0.0.0.0:*               LISTEN      -  tcp        0      0 127.0.0.1:41113         0.0.0.0:*               LISTEN      -  tcp        0      0 0.0.0.0:445             0.0.0.0:*               LISTEN      -  tcp        0      0 127.0.0.1:33060         0.0.0.0:*               LISTEN      -  tcp        0      0 127.0.0.1:44935         0.0.0.0:*               LISTEN      -  tcp        0      0 192.168.50.7:27017      0.0.0.0:*               LISTEN      -  tcp        0      0 127.0.0.1:27017         0.0.0.0:*               LISTEN      -  tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      -  tcp        0      0 0.0.0.0:139             0.0.0.0:*               LISTEN      -  tcp6       0      0 :::80                   :::*                    LISTEN      -  tcp6       0      0 :::32400                :::*                    LISTEN      -  tcp6       0      0 :::22100                :::*                    LISTEN      -  tcp6       0      0 :::445                  :::*                    LISTEN      -  tcp6       0      0 :::139                  :::*                    LISTEN      -  udp        0      0 127.0.0.53:53           0.0.0.0:*                           -  udp        0      0 192.168.50.7:68         0.0.0.0:*                           -  udp        0      0 172.17.255.255:137      0.0.0.0:*                           -  udp        0      0 172.17.0.1:137          0.0.0.0:*                           -  udp        0      0 192.168.50.255:137      0.0.0.0:*                           -  udp        0      0 192.168.50.7:137        0.0.0.0:*                           -  udp        0      0 0.0.0.0:137             0.0.0.0:*                           -  udp        0      0 172.17.255.255:138      0.0.0.0:*                           -  udp        0      0 172.17.0.1:138          0.0.0.0:*                           -  udp        0      0 192.168.50.255:138      0.0.0.0:*                           -  udp        0      0 192.168.50.7:138        0.0.0.0:*                           -  udp        0      0 0.0.0.0:138             0.0.0.0:*                           -  udp        0      0 127.0.0.1:33564         0.0.0.0:*                           -  udp        0      0 0.0.0.0:46034           0.0.0.0:*                           -  udp        0      0 0.0.0.0:5353            0.0.0.0:*                           -  udp        0      0 127.0.0.1:42818         0.0.0.0:*                           -  udp        0      0 0.0.0.0:51011           0.0.0.0:*                           -  udp        0      0 0.0.0.0:1901            0.0.0.0:*                           -  udp        0      0 192.168.50.7:38951      0.0.0.0:*                           -  udp        0      0 0.0.0.0:40101           0.0.0.0:*                           -  udp        0      0 0.0.0.0:32410           0.0.0.0:*                           -  udp        0      0 0.0.0.0:32412           0.0.0.0:*                           -  udp        0      0 0.0.0.0:32413           0.0.0.0:*                           -  udp        0      0 0.0.0.0:32414           0.0.0.0:*                           -  udp        0      0 192.168.50.7:57195      0.0.0.0:*                           -  udp        0      0 192.168.50.7:57254      0.0.0.0:*                           -  udp6       0      0 :::49275                :::*                                -  udp6       0      0 :::5353                 :::*                                -  raw6       0      0 :::58                   :::*                    7           -  

output of sudo iptables -nvL

Chain INPUT (policy DROP 4793 packets, 1589K bytes)   pkts bytes target     prot opt in     out     source               destination   666K  472M ufw-before-logging-input  all  --  *      *       0.0.0.0/0            0.0.0.0/0   666K  472M ufw-before-input  all  --  *      *       0.0.0.0/0            0.0.0.0/0   262K   63M ufw-after-input  all  --  *      *       0.0.0.0/0            0.0.0.0/0   155K   51M ufw-after-logging-input  all  --  *      *       0.0.0.0/0            0.0.0.0/0   155K   51M ufw-reject-input  all  --  *      *       0.0.0.0/0            0.0.0.0/0   155K   51M ufw-track-input  all  --  *      *       0.0.0.0/0            0.0.0.0/0    Chain FORWARD (policy DROP 0 packets, 0 bytes)   pkts bytes target     prot opt in     out     source               destination      0     0 DOCKER-USER  all  --  *      *       0.0.0.0/0            0.0.0.0/0      0     0 DOCKER-ISOLATION-STAGE-1  all  --  *      *       0.0.0.0/0            0.0.0.0/0      0     0 ACCEPT     all  --  *      docker0  0.0.0.0/0            0.0.0.0/0            ctstate RELATED,ESTABLISHED      0     0 DOCKER     all  --  *      docker0  0.0.0.0/0            0.0.0.0/0      0     0 ACCEPT     all  --  docker0 !docker0  0.0.0.0/0            0.0.0.0/0      0     0 ACCEPT     all  --  docker0 docker0  0.0.0.0/0            0.0.0.0/0      0     0 ufw-before-logging-forward  all  --  *      *       0.0.0.0/0            0.0.0.0/0      0     0 ufw-before-forward  all  --  *      *       0.0.0.0/0            0.0.0.0/0      0     0 ufw-after-forward  all  --  *      *       0.0.0.0/0            0.0.0.0/0      0     0 ufw-after-logging-forward  all  --  *      *       0.0.0.0/0            0.0.0.0/0      0     0 ufw-reject-forward  all  --  *      *       0.0.0.0/0            0.0.0.0/0      0     0 ufw-track-forward  all  --  *      *       0.0.0.0/0            0.0.0.0/0    Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)   pkts bytes target     prot opt in     out     source               destination   212K   16M ufw-before-logging-output  all  --  *      *       0.0.0.0/0            0.0.0.0/0   212K   16M ufw-before-output  all  --  *      *       0.0.0.0/0            0.0.0.0/0  44581 3006K ufw-after-output  all  --  *      *       0.0.0.0/0            0.0.0.0/0  44581 3006K ufw-after-logging-output  all  --  *      *       0.0.0.0/0            0.0.0.0/0  44581 3006K ufw-reject-output  all  --  *      *       0.0.0.0/0            0.0.0.0/0  44581 3006K ufw-track-output  all  --  *      *       0.0.0.0/0            0.0.0.0/0    Chain DOCKER (1 references)   pkts bytes target     prot opt in     out     source               destination    Chain DOCKER-ISOLATION-STAGE-1 (1 references)   pkts bytes target     prot opt in     out     source               destination      0     0 DOCKER-ISOLATION-STAGE-2  all  --  docker0 !docker0  0.0.0.0/0            0.0.0.0/0      0     0 RETURN     all  --  *      *       0.0.0.0/0            0.0.0.0/0    Chain DOCKER-ISOLATION-STAGE-2 (1 references)   pkts bytes target     prot opt in     out     source               destination      0     0 DROP       all  --  *      docker0  0.0.0.0/0            0.0.0.0/0      0     0 RETURN     all  --  *      *       0.0.0.0/0            0.0.0.0/0    Chain DOCKER-USER (1 references)   pkts bytes target     prot opt in     out     source               destination      0     0 RETURN     all  --  *      *       0.0.0.0/0            0.0.0.0/0    Chain ufw-after-forward (1 references)   pkts bytes target     prot opt in     out     source               destination    Chain ufw-after-input (1 references)   pkts bytes target     prot opt in     out     source               destination    326 26112 ufw-skip-to-policy-input  udp  --  *      *       0.0.0.0/0            0.0.0.0/0            udp dpt:137    730  180K ufw-skip-to-policy-input  udp  --  *      *       0.0.0.0/0            0.0.0.0/0            udp dpt:138      2    88 ufw-skip-to-policy-input  tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:139      2    88 ufw-skip-to-policy-input  tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:445     27  8992 ufw-skip-to-policy-input  udp  --  *      *       0.0.0.0/0            0.0.0.0/0            udp dpt:67      0     0 ufw-skip-to-policy-input  udp  --  *      *       0.0.0.0/0            0.0.0.0/0            udp dpt:68   106K   11M ufw-skip-to-policy-input  all  --  *      *       0.0.0.0/0            0.0.0.0/0            ADDRTYPE match dst-type BROADCAST    Chain ufw-after-logging-forward (1 references)   pkts bytes target     prot opt in     out     source               destination      0     0 LOG        all  --  *      *       0.0.0.0/0            0.0.0.0/0            limit: avg 3/min burst 10 LOG flags 0 level 4 prefix "[UFW BLOCK] "    Chain ufw-after-logging-input (1 references)   pkts bytes target     prot opt in     out     source               destination   4337 1529K LOG        all  --  *      *       0.0.0.0/0            0.0.0.0/0            limit: avg 3/min burst 10 LOG flags 0 level 4 prefix "[UFW BLOCK] "    Chain ufw-after-logging-output (1 references)   pkts bytes target     prot opt in     out     source               destination    Chain ufw-after-output (1 references)   pkts bytes target     prot opt in     out     source               destination    Chain ufw-before-forward (1 references)   pkts bytes target     prot opt in     out     source               destination      0     0 ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0            ctstate RELATED,ESTABLISHED      0     0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0            icmptype 3      0     0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0            icmptype 11      0     0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0            icmptype 12      0     0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0            icmptype 8      0     0 ufw-user-forward  all  --  *      *       0.0.0.0/0            0.0.0.0/0    Chain ufw-before-input (1 references)   pkts bytes target     prot opt in     out     source               destination  40237 2361K ACCEPT     all  --  lo     *       0.0.0.0/0            0.0.0.0/0   308K  387M ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0            ctstate RELATED,ESTABLISHED      0     0 ufw-logging-deny  all  --  *      *       0.0.0.0/0            0.0.0.0/0            ctstate INVALID      0     0 DROP       all  --  *      *       0.0.0.0/0            0.0.0.0/0            ctstate INVALID      0     0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0            icmptype 3      0     0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0            icmptype 11      0     0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0            icmptype 12      0     0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0            icmptype 8      0     0 ACCEPT     udp  --  *      *       0.0.0.0/0            0.0.0.0/0            udp spt:67 dpt:68   318K   82M ufw-not-local  all  --  *      *       0.0.0.0/0            0.0.0.0/0   1987  325K ACCEPT     udp  --  *      *       0.0.0.0/0            224.0.0.251          udp dpt:5353  53945   19M ACCEPT     udp  --  *      *       0.0.0.0/0            239.255.255.250      udp dpt:1900   262K   63M ufw-user-input  all  --  *      *       0.0.0.0/0            0.0.0.0/0    Chain ufw-before-logging-forward (1 references)   pkts bytes target     prot opt in     out     source               destination    Chain ufw-before-logging-input (1 references)   pkts bytes target     prot opt in     out     source               destination    Chain ufw-before-logging-output (1 references)   pkts bytes target     prot opt in     out     source               destination    Chain ufw-before-output (1 references)   pkts bytes target     prot opt in     out     source               destination  40237 2361K ACCEPT     all  --  *      lo      0.0.0.0/0            0.0.0.0/0   128K   11M ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0            ctstate RELATED,ESTABLISHED  44581 3006K ufw-user-output  all  --  *      *       0.0.0.0/0            0.0.0.0/0    Chain ufw-logging-allow (0 references)   pkts bytes target     prot opt in     out     source               destination      0     0 LOG        all  --  *      *       0.0.0.0/0            0.0.0.0/0            limit: avg 3/min burst 10 LOG flags 0 level 4 prefix "[UFW ALLOW] "    Chain ufw-logging-deny (2 references)   pkts bytes target     prot opt in     out     source               destination      0     0 RETURN     all  --  *      *       0.0.0.0/0            0.0.0.0/0            ctstate INVALID limit: avg 3/min burst 10      0     0 LOG        all  --  *      *       0.0.0.0/0            0.0.0.0/0            limit: avg 3/min burst 10 LOG flags 0 level 4 prefix "[UFW BLOCK] "    Chain ufw-not-local (1 references)   pkts bytes target     prot opt in     out     source               destination   151K   51M RETURN     all  --  *      *       0.0.0.0/0            0.0.0.0/0            ADDRTYPE match dst-type LOCAL  60270   19M RETURN     all  --  *      *       0.0.0.0/0            0.0.0.0/0            ADDRTYPE match dst-type MULTICAST   107K   12M RETURN     all  --  *      *       0.0.0.0/0            0.0.0.0/0            ADDRTYPE match dst-type BROADCAST      0     0 ufw-logging-deny  all  --  *      *       0.0.0.0/0            0.0.0.0/0            limit: avg 3/min burst 10      0     0 DROP       all  --  *      *       0.0.0.0/0            0.0.0.0/0    Chain ufw-reject-forward (1 references)   pkts bytes target     prot opt in     out     source               destination    Chain ufw-reject-input (1 references)   pkts bytes target     prot opt in     out     source               destination    Chain ufw-reject-output (1 references)   pkts bytes target     prot opt in     out     source               destination    Chain ufw-skip-to-policy-forward (0 references)   pkts bytes target     prot opt in     out     source               destination      0     0 DROP       all  --  *      *       0.0.0.0/0            0.0.0.0/0    Chain ufw-skip-to-policy-input (7 references)   pkts bytes target     prot opt in     out     source               destination   107K   12M DROP       all  --  *      *       0.0.0.0/0            0.0.0.0/0    Chain ufw-skip-to-policy-output (0 references)   pkts bytes target     prot opt in     out     source               destination      0     0 ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0    Chain ufw-track-forward (1 references)   pkts bytes target     prot opt in     out     source               destination    Chain ufw-track-input (1 references)   pkts bytes target     prot opt in     out     source               destination    Chain ufw-track-output (1 references)   pkts bytes target     prot opt in     out     source               destination    173 10348 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            ctstate NEW  44407 2995K ACCEPT     udp  --  *      *       0.0.0.0/0            0.0.0.0/0            ctstate NEW    Chain ufw-user-forward (1 references)   pkts bytes target     prot opt in     out     source               destination    Chain ufw-user-input (1 references)   pkts bytes target     prot opt in     out     source               destination      0     0 ACCEPT     tcp  --  *      *       73.6.251.121         0.0.0.0/0            tcp dpt:27017      0     0 ACCEPT     udp  --  *      *       73.6.251.121         0.0.0.0/0            udp dpt:27017     53  2812 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:22001      6   360 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:22000      3   132 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:21      6   344 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:22100    Chain ufw-user-limit (0 references)   pkts bytes target     prot opt in     out     source               destination      0     0 LOG        all  --  *      *       0.0.0.0/0            0.0.0.0/0            limit: avg 3/min burst 5 LOG flags 0 level 4 prefix "[UFW LIMIT BLOCK] "      0     0 REJECT     all  --  *      *       0.0.0.0/0            0.0.0.0/0            reject-with icmp-port-unreachable    Chain ufw-user-limit-accept (0 references)   pkts bytes target     prot opt in     out     source               destination      0     0 ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0    Chain ufw-user-logging-forward (0 references)   pkts bytes target     prot opt in     out     source               destination    Chain ufw-user-logging-input (0 references)   pkts bytes target     prot opt in     out     source               destination    Chain ufw-user-logging-output (0 references)   pkts bytes target     prot opt in     out     source               destination    Chain ufw-user-output (1 references)   pkts bytes target     prot opt in     out     source               destination  

iptables -t nat -nvL:

Chain PREROUTING (policy ACCEPT 35687 packets, 8678K bytes)   pkts bytes target     prot opt in     out     source               destination   4099 1364K DOCKER     all  --  *      *       0.0.0.0/0            0.0.0.0/0            ADDRTYPE match dst-type LOCAL    Chain INPUT (policy ACCEPT 6440 packets, 1931K bytes)   pkts bytes target     prot opt in     out     source               destination    Chain OUTPUT (policy ACCEPT 3131 packets, 314K bytes)   pkts bytes target     prot opt in     out     source               destination      1   278 DOCKER     all  --  *      *       0.0.0.0/0           !127.0.0.0/8          ADDRTYPE match dst-type LOCAL    Chain POSTROUTING (policy ACCEPT 3131 packets, 314K bytes)   pkts bytes target     prot opt in     out     source               destination      0     0 MASQUERADE  all  --  *      !docker0  172.17.0.0/16        0.0.0.0/0    Chain DOCKER (2 references)   pkts bytes target     prot opt in     out     source               destination      0     0 RETURN     all  --  docker0 *       0.0.0.0/0            0.0.0.0/0  

iptables -t mangle -nvL:

Chain PREROUTING (policy ACCEPT 0 packets, 0 bytes)   pkts bytes target     prot opt in     out     source               destination    Chain INPUT (policy ACCEPT 0 packets, 0 bytes)   pkts bytes target     prot opt in     out     source               destination    Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)   pkts bytes target     prot opt in     out     source               destination    Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)   pkts bytes target     prot opt in     out     source               destination    Chain POSTROUTING (policy ACCEPT 0 packets, 0 bytes)   pkts bytes target     prot opt in     out     source               destination  

Calculating Time of SHA1 in kernel

Posted: 01 Oct 2021 07:59 AM PDT

I am trying to calculate the time consumed to run SHA1 in the kernel level.

enter image description here

enter image description here

I had run the upper codes (inside a for loop) and the following was my result. It first showed about 30micro seconds and after about 300~400 times, it time suddenly dropped.

enter image description here

Here's my real question. I'm aware that the CPU can act differently time to time, I thought that the NUMA structure could or might effect these processes. But what I don't understand is that how could the time change with such difference?

Is there something that I'm missing here? And is there a more appropriate way to measure the time of cryptograpies.

Auditd rules to log only user typed commands - without cron etc

Posted: 01 Oct 2021 07:51 AM PDT

I already know how to log all commands from whole system.

-a exit,always -F arch=b64 -S execve  -a exit,always -F arch=b32 -S execve  

Now I want to log only commands executed by logged user.

Anyone who know how to tweak it?

Chrome OS Requirements

Posted: 01 Oct 2021 07:03 AM PDT

Looking at a refurbished/used Chromebox. The person in question will not be using any Linux apps. Just web browsing and YouTube. Will an older Celeron processor work?

Unix file size is bigger than real size

Posted: 01 Oct 2021 07:02 AM PDT

my Ubuntu Server (16.04) installation has a folder with 100 pictures in it.

Each picture is 100kb (true size) but it occupies 1MB (file size in disk), so 100 pictures are 100MB instead of 10MB.

I've read that it might be related to the filesystem format or the blocksize, but I don't know how to look for an answer to this problem, if such answer exist at all.

What I would like is for the files to only take up the space they need (100kb each) instead of 1MB.

Can someone help/explain? Links to online materials along with answers would also be very appreciated!

Thanks

How can I calculate the mean time value of this file with column with absolute Times

Posted: 01 Oct 2021 07:51 AM PDT

I haved a file like this:

    1633092723, TRANSFERCHECK: OK       1633092771, TRANSFERCHECK: OK       1633092777, TRANSFERCHECK: OK       1633092805, TRANSFERCHECK: OK       1633092811, TRANSFERCHECK: OK       1633092818, TRANSFERCHECK: OK       1633092823, TRANSFERCHECK: OK       1633092852, TRANSFERCHECK: OK       1633092857, TRANSFERCHECK: OK       1633092863, TRANSFERCHECK: OK       1633092891, TRANSFERCHECK: OK       1633092898, TRANSFERCHECK: OK       1633092904, TRANSFERCHECK: OK       1633092911, TRANSFERCHECK: OK       1633092938, TRANSFERCHECK: OK       1633092945, TRANSFERCHECK: OK       1633092953, TRANSFERCHECK: OK       1633092984, TRANSFERCHECK: OK   

the first colum is the absolut timestamp . How can I make an awk one-liner where the mean time between each abs. timestamp is calculated. It should be used to predicte the total duration of the process. I have done this but this makes the meantime of the timestamps and not the duration from one to the next one.

      cat myfetchlog.log | awk -F, '{sum+=$1} END {print strftime("%c",sum/NR)}'  

Thanks a lot. I am an awk beginner and would like to improve.

Allowing CORS for api.glossgenius.com

Posted: 01 Oct 2021 08:31 AM PDT

I need assistance, i am unsure how to make the API response from "api.glossgenius.com" work properly to get elements of the site working.

https://studio21md.com/portfolio

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://api.glossgenius.com/v3/web/portfolio_images?slug=meganhammett. (Reason: CORS header 'Access-Control-Allow-Origin' missing).

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://api.glossgenius.com/v3/web/portfolio_images?slug=meganhammett. (Reason: CORS request did not succeed).

Can anyone assist on Nginx how i would solve this specific issue?

Here is my config, Thank you for your assistance.

 server {      listen       80;      server_name  www.studio21md.com studio21md.com;      #charset koi8-r;      #access_log  logs/host.access.log  main;        location / {          proxy_pass   https://meganhammett.glossgenius.com;  }  

Fish Shell: Start up script issue

Posted: 01 Oct 2021 08:10 AM PDT

I am not a coder or a programmer, I just try to learn but I have some limitations...

I'd like to mount a webdav resource when I logging into the session (virtual console), however I'd like to check if the folder is empty to determine if the resource must be mounted or not.

This is the script that I tried to figure out:

if status is-interactive      # Commands to run in interactive sessions can go here      #      #      # Start WebDav      #      # check if the folder is empty      function tst           command find /mnt/drive -maxdepth 0 -empty      end            # Compare the variable and mount the resource      function drive          set mnt '/mnt/drive'          if test (tst) = $mnt              command rclone mount drive:/ /mnt/drive/ --vfs-cache-mode writes --daemon              else               # Actually I would use a "do nothing"              echo "Resource already mounted"          end      end             drive &      # end WebDav     end  

Unfortunately it doesn't work, the login session get stuck hence I have to open another virtual console getting this error:

= /mnt/drive               ^  ~/.config/fish/config.fish (line 12):           if test (tst) = $mnt             ^  in function 'drive'      called on line 19 of file ~/.config/fish/config.fish  from sourcing file ~/.config/fish/config.fish      called during startup  Resource already mounted  

I don't understand what I am doing wrong... 😩

Now it works thanks!!!

if status is-interactive      # Commands to run in interactive sessions can go here      #            # Start WebDav      function drive          set tst (find /mnt/drive -maxdepth 0 -empty)          set mnt '/mnt/drive'          if test "$tst" = "$mnt"              command rclone mount drive:/ /mnt/drive/ --vfs-cache-mode writes --daemon &          else               true          end      end            drive &       # end WebDav     end  

Fedora 34 lags when I play any video or audio

Posted: 01 Oct 2021 10:18 AM PDT

I dual booted windows and fedora 34. My windows works just fine when I play any video or audio but in fedora there is a lot of lag. Fedora works just fine when I don't play any video or audio. When I play a video in youtube the lag increases as I increase the resolution. I used ubuntu 20.04 also but there was no such lag and it worked just fine. enter image description hereenter image description hereenter image description hereenter image description hereenter image description hereenter image description hereenter image description here

Print all lines before pattern2 from the closest match of pattern1

Posted: 01 Oct 2021 10:30 AM PDT

I am fairly sure this has been asked before but I cannot locate an exact dupe.

My input looks like this:

Compiling File1  ... commands ...    Compiling File2  ... commands ...    Compiling File3  ... commands ...  In file included from ...  In file included from ...  In file included from ...  error: could not find A    Compiling File4  ... commands ...    Compiling File5  ... commands ...  In file included from ...  In file included from ...  In file included from ...  error: could not find B    

Expected output:

Compiling File3  ... commands ...  In file included from ...  In file included from ...  In file included from ...  error: could not find A  ---separator---  Compiling File5  ... commands ...  In file included from ...  In file included from ...  In file included from ...  error: could not find B  ---separator---  

I would like a shell command to print, for every match of error:, from the closest preceding match of Compiling to the current line, i.e. the full context of the error message. All other files that succeeded compilation can be skipped.

I suppose I can achieve this easily with awk or sed by keeping a pattern space comprising all text since the last match "Compiling", but there can be thousands of lines without an error. Would it be very inefficient?

Could NOT find CURL (missing: CURL_LIBRARY CURL_INCLUDE_DIR) with CMAKE_C_COMPILER_RANLIB:FILEPATH=/usr/bin/gcc-ranlib

Posted: 01 Oct 2021 09:08 AM PDT

I follow the installation facter

and I downloaded the latest version 3.9.6 tar.gz package.

enter image description here

but I get the below error:

[root@localhost release]# cmake ..  -- Could NOT find CURL (missing: CURL_LIBRARY CURL_INCLUDE_DIR)  CMake Error at CMakeLists.txt:69 (find_package):    By not providing "FindLeatherman.cmake" in CMAKE_MODULE_PATH this project    has asked CMake to find a package configuration file provided by    "Leatherman", but CMake did not find one.      Could not find a package configuration file provided by "Leatherman" with    any of the following names:        LeathermanConfig.cmake      leatherman-config.cmake      Add the installation prefix of "Leatherman" to CMAKE_PREFIX_PATH or set    "Leatherman_DIR" to a directory containing one of the above files.  If    "Leatherman" provides a separate development package or SDK, be sure it has    been installed.      -- Configuring incomplete, errors occurred!  See also "/tools/puppet/facter-3.9.6/release/CMakeFiles/CMakeOutput.log".  [root@localhost release]#    

the CMakeLists.txt:69 is:

CMAKE_C_COMPILER_RANLIB:FILEPATH=/usr/bin/gcc-ranlib  

I have curl in my CentOS 7.2 server,

  [root@localhost release]# curl --version  curl 7.29.0 (x86_64-redhat-linux-gnu) libcurl/7.29.0 NSS/3.36 zlib/1.2.7 libidn/1.28 libssh2/1.4.3  Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp scp sftp smtp smtps telnet tftp  Features: AsynchDNS GSS-Negotiate IDN IPv6 Largefile NTLM NTLM_WB SSL libz unix-sockets    

and I have tried install libcurl4-openssl-dev but there is no package:

yum  install libcurl4-openssl-dev -y  Loaded plugins: fastestmirror  Loading mirror speeds from cached hostfile   * base: mirrors.aliyun.com   * extras: mirrors.aliyun.com   * updates: mirrors.aliyun.com  No package libcurl4-openssl-dev available.  Error: Nothing to do  

How to merge two gz files into new outputfile with specific name

Posted: 01 Oct 2021 08:05 AM PDT

I have 96 *fastqc.gz raw read files from 24 samples. Each sample was sequenced on two lanees for each pair.

I would like to merge reads for each pair from both lanes into one output file with same name identifier from sample file name (2271_merged_R1_001.fastq.gz).

File names are in this order:  22[71-94]*R[1-2]_001.fastq.gz;    **2271**_ID890_1_S1_L001_**R1_001.fastq.gz**  **2271**_ID890_1_S1_L002_**R1_001.fastq.gz**    **2271**_ID890_1_S1_L001_**R2_001.fastq.gz**  **2271**_ID890_1_S1_L002_**R2_001.fastq.gz**  

I tried the following short script but only two output files are being generated (first and the last).

FOR R1 files

  for rf in 22[71-94]*R1_001.fastq.gz; do zcat $rf > 22"${71-94}"_merged_R1_001.fastq.gz ; done  

FOR R2 files

for rf in 22[71-94]*R2_001.fastq.gz; do zcat $rf > 22"${71-94}"_merged_R2_001.fastq.gz ; done  

My Questions are: 1. Why only two output files are generated? 2. The number of reads in the out put files are not the sum of the merged files from both lanes. 3. Is there a nice way, I could do the merging of reads from both lanes for both (R1 and R2) in single step instead of running it two times for each read type.

What went wrong in the code? and how could I verify that the output files are completely merged?

Thanks

how to use module in crontab

Posted: 01 Oct 2021 08:56 AM PDT

when I type "module available", it gives information of available of modules lie this.

--------------------------------- /tool/applic/module-3.2.10/Modules/3.2.10/modulefiles ----------------------------  Applic/Abaqus_2016_sp1       Applic/FDTD-8.15.716-1       Applic/Raphael_2006.12-SP2   Applic/Synopsys_sx_C2009-sp1  

and I want to save this information every 1 min. by using crontab.

so I "crontab -e" and edit like this

SHELL=/bin/bash  PATH=/sbin:/bin:/usr/sbin:/usr/bin  */1 * * * * module add something  */1 * * * * module list >> croninfo.txt       */1 * * * * module available >> croninfo.txt  

but croninfo.txt is empty. It seems like "module" is not working.

how can I make module work so that I can add modules.

Output something (in a loop) until a key is pressed

Posted: 01 Oct 2021 10:08 AM PDT

I'm trying to make a stopwatch, and when user press Q I want to exit.

I found two script, one where a clock is displayed until ctrl + z is pressed. And one script that exit if "q" is pressed.

I've tried to combined them, but "read" seems to mess it all up.

The reason I want to achieve this is that if the user press Q the time elapsed will be saved to a file.

Stopwatch:

BEGIN=$(date +%s)    echo Starting Stopwatch...    while true; do     NOW=$(date +%s)     let DIFF=$(($NOW - $BEGIN))     let MINS=$(($DIFF / 60))     let SECS=$(($DIFF % 60))     let HOURS=$(($DIFF / 3600))     let DAYS=$(($DIFF / 86400))       # \r  is a "carriage return" - returns cursor to start of line     printf "\r%3d Days, %02d:%02d:%02d" $DAYS $HOURS $MINS $SECS     sleep 0.25  done  

Exit on q:

while true; do      echo -en "Press Q to exit \t\t: "      read input      if [[ $input = "q" ]] || [[ $input = "Q" ]]           then break       else           echo "Invalid Input."      fi  done  

PS: I'm very new to this.

How to open rar file in linux?

Posted: 01 Oct 2021 09:23 AM PDT

I have a file with .rar extension, ex: foo.rar

I want to extract content from that file, how do I extract it?

How to achieve root privilege in Metasploitable 2 Linux?

Posted: 01 Oct 2021 08:12 AM PDT

Suppose, I have just entered the Metasploitable 2 Linux like the following command:

username : msfadmin  password : msfadmin  

Now, I need to gain 'root' privilege so that I do not need to use 'sudo' - command again and again. For example, in order to shutdown the machine I just want to type:

shutdown -h 1  

not,

sudo shutdown -h 1  

How to do that?

get age of given file

Posted: 01 Oct 2021 10:03 AM PDT

How can I get the age of a given file in, at least, days?

I'm well aware of ls -lh and similar commands. I want something that will work sort of like this:

getfage <FILE> # prints out '12d' (12 days)  

Also, this needs to be somewhat cross-platform since I'd also like to use this under Mac OS X, but the primary use-case is on my Linux-box.

NOTE

Since Linux doesn't track creation time, I'm looking for two-fold solution: one for mtime (linux)--that is the last time said file was modified--and one for Mac OS X, which can either deal with mtime or creation time.

No comments:

Post a Comment