Whereas this works as expected:
root#LIM:~# socat -d -d pty pty
2017/10/15 01:01:49 socat[91] N PTY is /dev/pts/0
2017/10/15 01:01:49 socat[91] N PTY is /dev/pts/1
2017/10/15 01:01:49 socat[91] N starting data transfer loop with FDs [5,5] and [7,7]
Including any argument at all causes socat to fail:
root#LIM:~# socat -d -d pty,echo=0 pty
2017/10/15 01:04:56 socat[92] N PTY is /dev/pts/0
2017/10/15 01:04:56 socat[92] E tcsetattr(5, TCSADRAIN, 0x7fffdafe8be0): Invalid argument
2017/10/15 01:04:56 socat[92] N exit(1)
I'm following this SO advice, this tutorial, and this blog and ultimately want to run a command that may resemble socat -d -d pty,link=/dev/ttyS0,raw,echo=0 pty,link=/dev/ttyS1,raw,echo=0 to establish a pair of virtual serial ports for COM1 and COM2.
I am using Bash on Ubuntu on Windows:
root#LIM:~# socat -V
socat by Gerhard Rieger - see www.dest-unreach.org
socat version 1.7.3.1 on Feb 2 2016 21:25:06
running on Linux version #1-Microsoft Wed Dec 31 14:42:53 PST 2014, release 4.4.0-43-Microsoft, machine x86_64
features:
#not shown for brevity
root#LIM:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.3 LTS
Release: 16.04
Codename: xenial
C:\Users\Aaron Borns>ver
Microsoft Windows [Version 10.0.15063]
What is wrong with the command to cause the Invalid argument error? Thank you for your help!
Related
I'm trying to run a simple forwarding proxy through another proxy server.
But as soon as I connect to the opened port (e.g. curl localhost:9090) an error is thrown and the connection is closed.
$ socat -v TCP-LISTEN:9090,fork PROXY:proxyhost:google.com:80,proxyport:8080
2020/03/01 15:00:00 socat[109218] E parseopts(): unknown option "proxyport:8080"
I'm using socat version 1.7.3.2 on May 11 2017 13:28:30
with features -> #define WITH_PROXY 1
I tried this on Suse as well as alpine linux and get the same result.
Am I doing something wrong or is this a bug?
Thanks in advance
I wrote to the mailing list and the maintainer made me aware of my mistake.
The parameter value must be seperated by an equals instead of a colon.
$ socat -v TCP-LISTEN:9090,fork PROXY:proxyhost:google.com:80,proxyport=8080
I have two laptops that each has connected to the Internet by landline (two different lines/modem). One is Mac and the other is Windows. I want to send a message from Windows to the Mac.
I installed NetCat on Mac using, brew install netcat, based on this page.
I installed NetCat on Windows based on this page.
I ran following command in Mac terminal in order to see what is my IP address: $ ipconfig getifaddr en0 it printed: 169.254.136.39
In Mac terminal: $ nc -u -l -p 4444. Seems it is ready for incomming messages.
In Windows terminal: $ nc -u 169.254.136.39 4444. I get a new line and I assume connection has established. However, when I enter a message and hit Enter, nothing happens :(
When I replace above command with nc -u -v -n 169.254.136.39 4444 in Windows and nc -u -l -n -p 4444 in Mac, then I get: (UNKNOWN) [169.254.136.39] 4444 (?) open
I have no idea what is wrong? I confirm Firewal is off on my Mac.
I want to share a Windows directory which is Sys64 in CentOS. I install cifs-utils in CentOS 7 and I run the command:
mount.cifs //ip/Sys64 share -o user=hostname,password=hostname_password
I get the following message:
mount error(112): Host is down Refer to the mount.cifs(8) manual page
(e.g. man mount.cifs)
cat /var/log/messages
Nov 21 13:51:44 zabbix kernel: CIFS VFS: cifs_mount failed w/return
code = -112
I tested with nmap:
[root#titi mnt]# nmap -p 445 ip -P0
Starting Nmap 6.40 ( http://nmap.org ) at 2018-11-21 14:25 CET Nmap
scan report for ip Host is up (0.069s latency). PORT STATE SERVICE
445/tcp open microsoft-ds
I want to share this directory, do you have any ideas on how I can do this?
i put vers=2.0
mount -t cifs -o vers=2.0,uid=1010,gid=1011,username=,password= //10.219.56.2/SysWOW64 share
I have an RPi 3b with Stretch installed. I'm generating and sending a message when the Pi boots about external IP / internal IP/ SSID it's connected with.
I have a script with a command that does these things, and this line to construct the message as JSON works fine when run as the pi user or even as root after sudo su -:
echo -e "{\"time\":\""$(date)"\",\"hostname\":\""$(hostname)"\", \"distro\":\""$(cat /etc/issue)"\",\"extip\":\""$(/usr/bin/curl ipecho.net/plain)"\",\"ssid\":\""$(/sbin/iwgetid -r)"\",\"lanip\":\""$(/bin/hostname -I)"\"}" > /home/pi/hostinfo.txt
This script works fine when I run it locally ( shows where the values I expect are there):
{"time":"Sat Sep 29 17:12:31 EDT 2018","hostname":"<expected hostname>", "distro":"Raspbian GNU/Linux 9
\l","extip":"<expected external IP>","ssid":"<expected SSID>","lanip":"<expected LAN IP>"}
I'm trying to run this at startup and the command runs fine and sends the message, but the last three values are blank:
-e {"time":"Sat Sep 29 17:12:31 EDT 2018","hostname":"",
"distro":"Raspbian GNU/Linux 9 \l","extip":"","ssid":"","lanip":""}
I've added the script call to both rc.local and crontab (not at the same time),
rc.local:
su pi -c '<path-to-script> > /home/pi/rpi-boot.log 2>&1'
crontab:
#reboot <path to script>
Either way, the script builds and delivers the message as expected and doesn't show any errors in rpi-boot.log, but when it's run by rc.local or crontab the first three values (date, hostname, distro) are reported correctly but the last three are blank.
I thought putting the full path to hostname, curl and IP would work, and they do when I run from an interactive shell but when run at startup they are returning blank.
I'd like to be able to sign into an ssh terminal and save the banner information, and immediately disconnect. For example i can ssh into my terminal with:
sshpass -p[PASSWORD] ssh -p 2201 [USER_NAME]#ipaddress
I get the following login welcome banner:
Linux 2.6.21 #1 PREEMPT Tue Feb 1 16:12:56 CST 2011
Site ID: xml
Last login: Wed Aug 3 09:25:29 2016 from 156.98.4.11
I can pipe the "last login" information with
sshpass -p[PASSWORD] ssh -p 2201 [USER_NAME]#ipaddress > lastlogin.txt
However, this doesn't save the rest of the banner and I still have to hit ctrl+d to disconnect. Any help would be appreciated.
The "login welcome banner" is motd (message of the day).
Motd message should be located located in /etc/motd and you should be able to copy it to your machine using scp command.
The command to do get motd would look something like:
sshpass -p [PASSWORD] scp -P [PORT] [USER_NAME]#[IP_OR_HOST]:/etc/motd lastlogin.txt
Nemanjas command is great, but be aware that the login banner isn't always located in the same file. On Ubuntu systems it's located in /etc/issue.net. The safest way would be to read the /etc/ssh/sshd_config file, where the Banner attribute is set.
grep Banner < /etc/ssh/sshd_config | cut -d' ' -f 2
Use this command to extract the file name.