Seeking SSH emulator that behaves as a terminal on the server side - ssh

I write code for embedded control systems and frequently use proprietary black-box modules to communicate with external devices. In my world, RS-232 connectivity is still commonplace. More and more devices, however, are joining the modern world and implementing various TCP and UDP options.
One such device runs an SSH server and interacts with an SSH client opened by the proprietary module. I have to develop code without the device. If this were RS-232, I could simply open a terminal connected to RS-232 and interact with the module, seeing what is sent and sending replies to observe the module's behaviour.
I'm looking for SSH and Telnet "servers" that would allow me to do the same for sessions on those protocols. So far, I've found SSH honeypots that allow me to see payloads from the client, but nothing that lets me send strings in return.
I suspect there's a solution out there, but I simply haven't the vocabulary to describe it. All clues welcome.

Related

How SSH X11 forwarding is achieved over the browser

I am planning to implement the functionality given by SSH -X . This is used to open GUI based application remotely. So I want to understand what are the components involved and should be implemented.
I know how to setup this like starting VNC server in the host and assign DISPLAY variable.
And do SSH -X connection from remote client and execute the required GUI app shell script (for example xeyes, xclock etc.,).Please share if anyone is having more advanced information. My requirement is to design a web based "SSH X" client. There are lot of tools available in the market for Web SSH but no tools with SSH X11 forwarding support.
The X11 protocol is intrinsically network transparent, so ssh -X simply sets up a port on the remote system and sets the DISPLAY variable so that X programs write the X11 protocol to that port, which it then streams back to the local side. (This is a simplification; there's also authentication involved.)
If you want to do this in the browser, you'll first have to have some sort of server-side component that does the SSH operations and converts the stream of data to something the browser can use. Browsers do not allow opening arbitrary TCP ports to remote systems in JavaScript, since doing so is a massive security risk.
You'll also have to find some way to render the X11 protocol in the browser. Essentially you'll be implementing a web-based X server (hopefully in something like WebAssembly). You should read the existing specifications for that and look at popular open-source X11 implementations, such as Xorg.
I should point out that this is a colossal amount of work due to the requirement to implement a full X server. VNC-based protocols are much simpler because they don't need to implement drawing primitives, only render (possibly compressed) images streams on the screen.

How to to run program when USB is inserted?

Hi I have one program that I need to run on my server but the problem is that my server don't have any monitor, keyabord and mouse attach to it so I can confirn when windows 7 ask me to run program so is posible to just plug USB Mass Storage device in a computer and computer would execute this without any qestions?
Perhaps you could look into using autorun or some variant thereof (e.g. a program that would monitor the USB bus for devices, and automatically run some program when it detects that an appropriate storage device has been connect).
Bear in mind that, depending on the physical setup, this could be used as an attack vector.
As Celeriko said, you should try to find a way into connecting to your server remotely. Whether that be through SSH or a tool such as PUTTY (basically SSH right? I'm not sure off top of my head).
Having a usb automatically execute something would be a security risk and I believe it is restricted for that reason.
Best of luck trying to connect remotely into your server, it shouldn't be too difficult.

UDP Hole punching unsuccessful, but tests show it should work (mobile network)

For the past two week I have been unsuccessfully trying to implement udp hole punching, but I'm not sure why. I understand that the algorithm for hole punching is not guaranteed to work, but I believe it should work in my test case because I have noticed that once I bind my socket on my home-network, the port is the same to the outside world as it is locally, and stays that way for all connections made from this socket. Any help after reviewing my trials would be appreciated.
I have three computers, my osx desktop, my iPhone, and my amazon ec2 ami.
on the desktop I've built a cocoa app which uses the GCDAsyncUDPSocket library to bind a port and contact the ec2 server, where a java app using apache's mina library stores the sockets external ip/port and associates it with a username passed in the payload.
the iphone, which is on the AT&T network runs an app which uses the same GCDAsyncUDPSocket library to contact the ec2 server with the same username, which then the ec2 does a lookup for the username, finds the desktops info and informs the desktop of the iphones address and the iphone of the desktops address.
now the iphone & the desktop know about each other they start shooting off packets at each other in hopes to get a punched hole.
in theory this should work, but maybe I am missing something about mobile networks that would make this difficult? But then again running a simple udp echoer on a 4th external computer to manually msg the desktop did not work either, so maybe its my router, but I don't see how that could be as all my tests show that the port the desktop asks for is the same one assigned by the router.
I've been at this for nearly two weeks with little progress and any tips would be appreciated!
"once I bind my socket on my home-network, the port is the same to the outside world as it is locally"
I highly doubt that. To traverse NAT given peers A and B which have sent datagrams to a 3rd party: S you need to send datagrams from A to B and vice versa using their public IPs as seen by S and their port as seen by S (i.e. not the port A, B are bound to from their point of view).

WWAN Interface AT Commands

I've got a Windows 8 Professional device which has got a Mobile Broadband adapter embedded and I need to be able to send AT commands to the modem, usually I'd connect to the COM port and send the commands. However the device doesn't appear to have any COM ports, instead it presents its self as a network adapter.
I'm wanting to send AT commands to change the APN of the modem and to reset the device, I've looked into the 'netsh mbn add profile' but this command always returns an error advising that the XML profile is incorrect.
Also from looking at the functions of the netsh mbn it doesn't seem to provide as much control as sending AT commands.
The modem that I'm trying to interface to is the Ericsson C5621 GW on a Lenovo ThinkPad Tablet 2.
Is there another way to send AT commands?
Thanks
I do not know this product in particular, but since I worked in Ericsson, later in ST-Ericsson with mobile phone development for over a decade it is doomed to have some of my code in it so I'll answer on a general basis.
Short version is, no unless the device exposes a serial interface over one of the external interfaces (possible interface types are RS-232, IrDA, Bluetooth, USB or CAIF), there is no way of sending AT commands to it1.
Being an embedded device in a laptop and
your since you say it seems to be without serial interfaces I assume it uses CAIF (commonly used in embedded settings. It could also have be using USB with the serial interfaces disabled, but since this press release mentions that it will be available in a version with PCI interface, that is very unlikely). And thus unless the device is set up with any active VEI channels, there is no ways in for AT commands.
There might be other ways of changing the APN though.
1 We had a debug mechanism to inject AT commands onto arbitrary serial interfaces, but this itself was running on a serial interface, started by an AT command. And besides it will not be present in released products.

What is X Server and Remote Terminal Server?

Can someone explain what is the difference between X server and Remote Terminal servers in simple terms?
For example, Hummingbird Exceed is an X server and Citrix is a Remote Terminal Server. How do these servers work?
A terminal server runs at the "other" machine while you use a remote desktop client to view the other machine's screen.
A X server (of the X11 Window System) runs on your machine while another machine (or several thereof) send their output to your computer.
The most important difference to the end user is probably "culture": With the X Window system you typically work with windows that run on several hosts. (You often sit in front of a quite stripped down workstation, get one application from one computer, another one from another computer.) When working with X things feel very heterogeneous - a special application only runs on a HP workstation while your company is stuffed with suns or linux boxes? No problem, just buy one HP, everone can use that application over the network like as it was local.)
Remote terminal services feel more like another computer sends its complete screen to you, more like you have a 100-Mile-Long monitor and usb cable (with a little lag built in). You typically use a remote desktop client that sends a complete desktop to you.
However in recent times both techniques get close to another - windows remote desktop (which is based on citrix) can send only application windows to your desktop, while a lot of programs based on X11 are theoretically network transparent but practically need to run on the local machine. (Sorry, no 3D shooter over the network - an extreme example).
Which one is better? I don't dare to say. White X11 is a lot more flexible (it was designed with network transparency in mind - it makes absolutely no difference if an application runs local or remote - it is in many aspects more complicated. As long as there was no remote desktop sharing there was a clear advantage, but slowly the gap is closing, for example by terminal services now allowing you to do many things that were available with X11 only in earlier times.)
By the way, the main reason many X11 application still feel a little "snappier" over the network than windows counterparts is the thing that many application programmers on windows still think they always run local and dump a lot of bitmap graphics on the screen - like custom toolbars in ZIP tools. X11 applications did not do this for a long time and chose "ugly but fast" because X11 forces you to think about the network. But as X11 applications get more pretty and Windows programmers more aware about terminal services the difference will dwindle.
Oh and an important point: X11 is deeply ingrained in the Unix way of things, Citrix is mainly used on Windows (in the form of Microsoft's Windows Terminal Services - which originated in Citrix code). So lock a terminal services admin and a X11 operator into a cage and step back watching bloodshed when they figure out who they are locked in with ...
An X server most likely refers to the X11 windowing system, which is the GUI that most unix flavors (including linux) use. It's a client/server setup, and has been around for a very long time
A remote Terminal Server in the case of Citrix is a remote windows instance that can be connected to with a special Citrix client. The Citrix environments I'm familiar with are all MS Windows solutions, ie they work similar to X, but are for Windows Servers only
They both sort of operate in similar fashions, which is serving a remote client a windowing solution. IE, they both let a server run the actual application while the display of that application is sent back over the network to a client PC.
A 'Terminal Server', as it's called, basically allow you to connect to a Windows session remotely. They employ a bit of magic to make the experience snappy over connections with latency. The Windows GUI system isn't network transparent like X, so it took a while longer to get this feature. Windows Server 2008 and Citrix products have the ability to let you use a single application, unlike the traditional Terminal Server.
X is the GUI protocol for Unix/Linux. The X server accepts connections and displays their windows. The clients are actually the programs themselves. These clients can be local or remote, it doesn't matter to X. X just displays them as requested, on the local screen or over a TCP connection. This is lower level stuff than terminal servers, and allows graphical programs to run on one machine and display on another. X11 doesn't compress or encrypt the traffic like RDP does (although SSH can help you out there).
The linux equivalent of RDP is NX. They provide free software to run NX servers/clients. I've used it and it works pretty well.