Quantcast
Channel: SSH.NET Library
Viewing all 2955 articles
Browse latest View live

Commented Unassigned: An operation was attempted on something that is not a socket. [1940]

$
0
0
I keep getting this error when connecting and uploading a file. There are no errors in Event Log or otherwise.

Here's my code:

SSHNet.PasswordConnectionInfo connInfo = new SHNet.PasswordConnectionInfo(xxxxxxxxxxx);

using (var client = new SSHNet.SftpClient(connInfo))
{
client.Connect();
if (client.IsConnected)
{
using (Stream fileStream = EncryptionUtilities.DecryptFile(path))
{
client.UploadFile(fileStream, path);
fileStream.Flush();
fileStream.Close();
fileStream.Dispose();
}
}

client.Disconnect();
}

Any suggestions highly appreciated.
Comments: ** Comment from web user: avidyarthi **

No solution for this?


New Post: on cisco router no response after send Enable

$
0
0
Paul(PE),

A change in symptoms is always a Good(tm) thing! :)

Since Cisco is just the ios, note the ios versions on known good, and known bad routers, along with model (s).

In the case where the sshd implementation subtly changed, this info is valuable in prod dev for things like release notes.

Glad you stuck with it!

pat
:)

Commented Unassigned: Need to delete redundant encryptions when using ConnectionInfo [1914]

$
0
0
Need to delete redundant keys in order to communicate with some servers. More than one encryption throws an exception.

foreach (var d in connectionInfo.Encryptions.Where(p => p.Key != "aes256-cbc").ToList())
{
connectionInfo.Encryptions.Remove(d.Key);
}
Comments: ** Comment from web user: c_t_klein **

I don't have a public server but I can say that I run into the same problem connecting to a Tumbleweed FTP server and I have to do a similar piece of code:

foreach (var d in connectionInfo.Encryptions.Where(p => p.Key != "aes128-cbc").ToList()) { connectionInfo.Encryptions.Remove(d.Key); }

New Post: on cisco router no response after send Enable

$
0
0
Thanks Pat,

Question remains: why can I send the Enable command and password using SharpSSH and also using terminal emulators like Putty and SecureCRT? Granted IOS versions are not all the same and even not all as reliable, but still if I can use a program using the SharpSSH library then why not SSH.NET?

Paul

New Post: on cisco router no response after send Enable

$
0
0
but still if I can use a program using the SharpSSH library then why not SSH.NET?
I doubt anyone here knows. There are no doubt subtleties as to how they both (and others) interpret and interface/interact with the SSH protocol. Also, we will never know why Cisco IOS is reacting differently to different approaches.

I would not assume that Cisco is not doing something to make connections "easier" for COTS TTY programs. They no doubt could care less about how GASP Open Source ssh libraries behave with their products.

It may be as simple as "If you find something that works, then use it". This project, like thousands of others, depends on people like you to find the issues and inconsistencies, sure, but also to determine work-arounds for source code.

And of course the obligatory caveat: If something in Cisco does/doesn't work today, it may be the opposite tomorrow for no reason whatsoever.

Happy Hunting!

pat
:)

Source code checked in, #35330

$
0
0
Unsubscribe from events before disposing WaitHandles. This reduces the likelyhood of invoking Set() on a disposed WaitHandle. Incomplete fix for issues #1944 and #1942 as eventhandlers could still be invoked after unsubscription.

Source code checked in, #35331

$
0
0
Unsubscribe from events before disposing WaitHandles. This reduces the likelyhood of invoking Set() on a disposed WaitHandle. Incomplete fix for issues #1944 and #1942 as eventhandlers could still be invoked after unsubscription.

Commented Unassigned: various System.ObjectDisposedException [1944]

$
0
0
during a long connection I get following exceptions:

```
System.ObjectDisposedException: Das SafeHandle wurde geschlossen.
bei Renci.SshNet.Session.WaitHandle(WaitHandle waitHandle) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Session.cs:Zeile 642.
bei Renci.SshNet.Channels.Channel.WaitHandle(WaitHandle waitHandle) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Channels\Channel.cs:Zeile 496.
bei Renci.SshNet.Channels.ChannelSession.Open() in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Channels\ChannelSession.cs:Zeile 52.
bei Renci.SshNet.ShellStream..ctor(Session session, String terminalName, UInt32 columns, UInt32 rows, UInt32 width, UInt32 height, Int32 maxLines, IDictionary`2 terminalModeValues) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\ShellStream.cs:Zeile 73.
bei Renci.SshNet.SshClient.CreateShellStream(String terminalName, UInt32 columns, UInt32 rows, UInt32 width, UInt32 height, Int32 bufferSize, IDictionary`2 terminalModeValues) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\SshClient.cs:Zeile 384.
bei Renci.SshNet.SshClient.CreateShellStream(String terminalName, UInt32 columns, UInt32 rows, UInt32 width, UInt32 height, Int32 bufferSize) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\SshClient.cs:Zeile 366.
```

and

```
System.ObjectDisposedException: Das SafeHandle wurde geschlossen.
bei System.Runtime.InteropServices.SafeHandle.DangerousAddRef(Boolean& success)
bei Microsoft.Win32.Win32Native.SetEvent(SafeWaitHandle handle)
bei System.Threading.EventWaitHandle.Set()
bei Renci.SshNet.ShellStream.Channel_DataReceived(Object sender, ChannelDataEventArgs e) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\ShellStream.cs:Zeile 739.
bei Renci.SshNet.Channels.Channel.OnData(Byte[] data) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Channels\Channel.cs:Zeile 289.
bei Renci.SshNet.Channels.Channel.OnChannelData(Object sender, MessageEventArgs`1 e) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Channels\Channel.cs:Zeile 590.
bei System.EventHandler`1.Invoke(Object sender, TEventArgs e)
bei Renci.SshNet.Session.OnChannelDataReceived(ChannelDataMessage message) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Session.cs:Zeile 1392.
bei Renci.SshNet.Session.HandleMessage(ChannelDataMessage message) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Session.cs:Zeile 1034.
bei CallSite.Target(Closure , CallSite , Session , Object )
bei Renci.SshNet.Session.HandleMessageCore(Message message) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Session.NET40.cs:Zeile 20.
bei Renci.SshNet.Session.MessageListener() in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Session.cs:Zeile 1589.
```

The application opens a ssh connection and opens/parses a ShellStream every 10 seconds.
IsConnected stays true.

I currently can't test the current beta since it has issues with closing the channel after
disposing the ShellStream.

No errors or unusual log entries on the server side.
Comments: ** Comment from web user: drieseng **

I still have not been able to reproduce the issue, but I commit a few small changes that should improve the odds of not hitting the ObjectDisposedException.

Note that I do not consider these changes a real fix as we'd have to introduce more synchronization for that.
The problem is that we're disposing the WaitHandle instances, but our event handlers that use these WaitHandle instances are getting triggered after the dispose of the WaitHandle instances.

I've now moved the unsubscription up, but the real fix would be to synchronize the dispose and the set of the WaitHandles. Before I go down that road, I'll still like to know the effect of the changes I committed today.

Can you build from SVN, and try again ?


Commented Unassigned: An operation was attempted on something that is not a socket. [1940]

$
0
0
I keep getting this error when connecting and uploading a file. There are no errors in Event Log or otherwise.

Here's my code:

SSHNet.PasswordConnectionInfo connInfo = new SHNet.PasswordConnectionInfo(xxxxxxxxxxx);

using (var client = new SSHNet.SftpClient(connInfo))
{
client.Connect();
if (client.IsConnected)
{
using (Stream fileStream = EncryptionUtilities.DecryptFile(path))
{
client.UploadFile(fileStream, path);
fileStream.Flush();
fileStream.Close();
fileStream.Dispose();
}
}

client.Disconnect();
}

Any suggestions highly appreciated.
Comments: ** Comment from web user: drieseng **

It's probably a long shot, but have a look at the workaround suggested by these kb articles:
http://support.microsoft.com/kb/817571
http://support.microsoft.com/kb/318584

Would it be possible for you to debug the SSH.NET code ?
Can you verify whether the upload completed successfully ?
Are you using multiple threads ?

Closed Unassigned: Problems with IPSwitch MoveIt SSH server [1785]

$
0
0
Has anyone had problems when using the code with IPSwitch MoveIt ?

I can connect OK, list files, rename, upload & download. But when I try to delete a file I get "permission denied".
Although if I connect to the MoveIt server with Filezilla client I can delete the file, so it's not a permissions issue.
And my code is fine because I can delete files no problem from UNIX & LINUX servers.
It has a similar problem when I try to overwrite an existing file.

Any help would be appreciated.

Cheers

Phil
Comments: Submitter confirmed offline that this issue is fixed in SSH.NET 2014.4.6-beta1.

New Post: Get the string result from Execute() during the execution

$
0
0
Well first of all I have to say I have used this library for a couple of projects and I like it! And really do appreciate the work all developers have done. So hats off to them :)

And secondly, I didn't intend to be rude, I was more baffled to be honest in reference to my opening.

I must say, it's very ironic of you to call me lazy. Because a) I wasn't lazy. b) You didn't fully comprehend my question. So you violated your own rule there, read/comprehend before you rant;)

I am very well aware of the Begin/EndExecute. However it does not address the question of polling or being notified on how the SshCommand is progressing during it's execution.
I am also aware of SshCommand.OutputStream. However, I am not very sure about consequences of read/write in terms of unwanted side effects/bugs of reading the stream while BeginExecute write. One side effect seem to be that the result is empty on EndExecute. And reading the OutputStream on another thread is totally out of the question and not thread safe. I even tried it for good measure.
So that was my issue. Which I could not find a good example of or answer to. Instead of assuming, I wanted to ask. It seems I am able to solve my case, but Imho it would be nice to have a way to plug into SshCommands progress that is conspicuous to any developer using ssh.net and effective in terms of resources and implementation. And which the developer can have full confidence in using, in a multi-threaded world. If there is a way, I haven't seen it yet.

Also, to be exact, you got APM and Async mixed up.. they solve the same problem, but they are distinct paradigms in the world of .net. The Begin/End methods you are referencing follow the APM paradigm, not Async. Do your homework! ;) As you so eloquently said.

And finally, keep in mind, we're on the same team :)
You know the devs do it in their freetime? And they give to you for free! Insane, right?
You have a private life too, aye? Sometimes it can happen questions get forgotten, no reason to ask such a rude question!
I try to answer a lot of questions, but it's also my freetime! And I do it since I like this project and want to help the devs.
You should try it, too! Helping is nice :)

Beside this is a well documented feature in the docs. You always should read the docs and ask questions then.
Else you look like a lazy person.

New Post: Get the string result from Execute() during the execution

$
0
0
"Why has there been no response to this question? ... Can anyone give feedback on this? Is it possible today?"

"And secondly, I didn't intend to be rude, I was more baffled to be honest in reference to my opening."
__
<$0.02>

You seem confused. This might help:
  1. Act on a public forum as if you are talking to your [almost] deaf Grandmother. Don't be upset, or imply demands, or ask why she hasn't answered your question. Be instead polite & respectful, but not condescending. She may ask you to repeat, or ask the question a different way, but she still means well. She's old & sensitive, really does want to help, but still not stupid.
  2. What you write should be taken as polite & considerate even when shouted. If I was to shout to a group of people I didn't know "Why has there been no response to this question?", who would be surprised if they snubbed me?
  3. If there is any chance, however remote, of your post being taken as rude, or the opposite of what you intended, by native or non-native speakers, it will be. Assume that.
  4. How you write paints a picture of who you are-it's all we can go by, after all! So you might be the nicest person in the world, but all the public has to go by is what you write, and how you write it. If you are a swell person, and a horrible communicator, you won't make the impression you think you're giving. Just be tolerant of the communications vehicle you are using, and how little we all have to go by.
  5. If you can't work with this program/suite alone, then you just need to be able to communicate your needs professionally & respectfully. The forum has already given you direct feedback on what isn't working, so consider it advice and move forward.
Giving respect, and not demanding it, will get you the world.

</$0.02>

Best,
pat
:)

New Post: Get the string result from Execute() during the execution

$
0
0
Thanks to BogusException to explain Internet Communications 101.
It should make you think that two people seemed to read your post as rude and unfriendly.

Btw. don't make fun of non-native speakers on the internet. Thats even more rude than your first post.
So I won't help you. But maybe you are lucky and someone else will.

Oh, we are totally not on the same team. It's your first time posting here, I don't know you and currently
I don't think it's worth the effort.

Commented Unassigned: various System.ObjectDisposedException [1944]

$
0
0
during a long connection I get following exceptions:

```
System.ObjectDisposedException: Das SafeHandle wurde geschlossen.
bei Renci.SshNet.Session.WaitHandle(WaitHandle waitHandle) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Session.cs:Zeile 642.
bei Renci.SshNet.Channels.Channel.WaitHandle(WaitHandle waitHandle) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Channels\Channel.cs:Zeile 496.
bei Renci.SshNet.Channels.ChannelSession.Open() in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Channels\ChannelSession.cs:Zeile 52.
bei Renci.SshNet.ShellStream..ctor(Session session, String terminalName, UInt32 columns, UInt32 rows, UInt32 width, UInt32 height, Int32 maxLines, IDictionary`2 terminalModeValues) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\ShellStream.cs:Zeile 73.
bei Renci.SshNet.SshClient.CreateShellStream(String terminalName, UInt32 columns, UInt32 rows, UInt32 width, UInt32 height, Int32 bufferSize, IDictionary`2 terminalModeValues) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\SshClient.cs:Zeile 384.
bei Renci.SshNet.SshClient.CreateShellStream(String terminalName, UInt32 columns, UInt32 rows, UInt32 width, UInt32 height, Int32 bufferSize) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\SshClient.cs:Zeile 366.
```

and

```
System.ObjectDisposedException: Das SafeHandle wurde geschlossen.
bei System.Runtime.InteropServices.SafeHandle.DangerousAddRef(Boolean& success)
bei Microsoft.Win32.Win32Native.SetEvent(SafeWaitHandle handle)
bei System.Threading.EventWaitHandle.Set()
bei Renci.SshNet.ShellStream.Channel_DataReceived(Object sender, ChannelDataEventArgs e) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\ShellStream.cs:Zeile 739.
bei Renci.SshNet.Channels.Channel.OnData(Byte[] data) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Channels\Channel.cs:Zeile 289.
bei Renci.SshNet.Channels.Channel.OnChannelData(Object sender, MessageEventArgs`1 e) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Channels\Channel.cs:Zeile 590.
bei System.EventHandler`1.Invoke(Object sender, TEventArgs e)
bei Renci.SshNet.Session.OnChannelDataReceived(ChannelDataMessage message) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Session.cs:Zeile 1392.
bei Renci.SshNet.Session.HandleMessage(ChannelDataMessage message) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Session.cs:Zeile 1034.
bei CallSite.Target(Closure , CallSite , Session , Object )
bei Renci.SshNet.Session.HandleMessageCore(Message message) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Session.NET40.cs:Zeile 20.
bei Renci.SshNet.Session.MessageListener() in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Session.cs:Zeile 1589.
```

The application opens a ssh connection and opens/parses a ShellStream every 10 seconds.
IsConnected stays true.

I currently can't test the current beta since it has issues with closing the channel after
disposing the ShellStream.

No errors or unusual log entries on the server side.
Comments: ** Comment from web user: da_rinkes **

Currently testing it! Thanks for the quick response.

Will report later how the test-tool worked against current sources.

New Post: Proposal: Switching to GIT?

$
0
0
Just in case anybody else wants to export the repository from svn to git:

git svn clone --no-metadata https://sshnet.svn.codeplex.com/svn/ ssh.net --revision 9489:35331

I skip all commits previous to 9489 cause there is an error (maybe a broken commit?) at revision 9486.

Commented Unassigned: various System.ObjectDisposedException [1944]

$
0
0
during a long connection I get following exceptions:

```
System.ObjectDisposedException: Das SafeHandle wurde geschlossen.
bei Renci.SshNet.Session.WaitHandle(WaitHandle waitHandle) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Session.cs:Zeile 642.
bei Renci.SshNet.Channels.Channel.WaitHandle(WaitHandle waitHandle) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Channels\Channel.cs:Zeile 496.
bei Renci.SshNet.Channels.ChannelSession.Open() in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Channels\ChannelSession.cs:Zeile 52.
bei Renci.SshNet.ShellStream..ctor(Session session, String terminalName, UInt32 columns, UInt32 rows, UInt32 width, UInt32 height, Int32 maxLines, IDictionary`2 terminalModeValues) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\ShellStream.cs:Zeile 73.
bei Renci.SshNet.SshClient.CreateShellStream(String terminalName, UInt32 columns, UInt32 rows, UInt32 width, UInt32 height, Int32 bufferSize, IDictionary`2 terminalModeValues) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\SshClient.cs:Zeile 384.
bei Renci.SshNet.SshClient.CreateShellStream(String terminalName, UInt32 columns, UInt32 rows, UInt32 width, UInt32 height, Int32 bufferSize) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\SshClient.cs:Zeile 366.
```

and

```
System.ObjectDisposedException: Das SafeHandle wurde geschlossen.
bei System.Runtime.InteropServices.SafeHandle.DangerousAddRef(Boolean& success)
bei Microsoft.Win32.Win32Native.SetEvent(SafeWaitHandle handle)
bei System.Threading.EventWaitHandle.Set()
bei Renci.SshNet.ShellStream.Channel_DataReceived(Object sender, ChannelDataEventArgs e) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\ShellStream.cs:Zeile 739.
bei Renci.SshNet.Channels.Channel.OnData(Byte[] data) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Channels\Channel.cs:Zeile 289.
bei Renci.SshNet.Channels.Channel.OnChannelData(Object sender, MessageEventArgs`1 e) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Channels\Channel.cs:Zeile 590.
bei System.EventHandler`1.Invoke(Object sender, TEventArgs e)
bei Renci.SshNet.Session.OnChannelDataReceived(ChannelDataMessage message) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Session.cs:Zeile 1392.
bei Renci.SshNet.Session.HandleMessage(ChannelDataMessage message) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Session.cs:Zeile 1034.
bei CallSite.Target(Closure , CallSite , Session , Object )
bei Renci.SshNet.Session.HandleMessageCore(Message message) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Session.NET40.cs:Zeile 20.
bei Renci.SshNet.Session.MessageListener() in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Session.cs:Zeile 1589.
```

The application opens a ssh connection and opens/parses a ShellStream every 10 seconds.
IsConnected stays true.

I currently can't test the current beta since it has issues with closing the channel after
disposing the ShellStream.

No errors or unusual log entries on the server side.
Comments: ** Comment from web user: da_rinkes **

Looks good so far.

While the current library showed no ObjectDisposedException in 2 hours,
the old one had 30 Exceptions.

The new library has some new weird exceptions/races.
e.g IsConnected returns false while a reconnect returns "client is already connected".
But this is another issue.

New Post: SSH.NET Developers, Supporters, Moderators, Contributors, Users: Thank You!

$
0
0
Developers & Associated Contributors to SSH.NET,

I write programs for myself, and rarely for the benefit of my employers. I write in several languages, and have been doing it for more years than I want to admit... :)

When I buy a book, I go look at reviews by readers like myself. When I choose software to use, pay or otherwise, I also look to the user community. But the most important thing to me, and hopefully others, is a product/suite/tool that is supported.

What I mean is that it has both an active development team, but also an active user community. A product can always be made better-but only if it is supported.

Together, they work as a team, serving more than one purpose. Support forums like this are primarily for problems, so you might think that SSH/NET has nothing but problems... but that isn't the case. There are more success stories than problem stories, it's just that there isn't a place to talk about them, or to say "thanks!".

So, I will take this opportunity to thank all the developers, and other helpers, that make SSH.NET a viable, supported, active product for the appreciative user community, of which I am proud to be a member.

I hope this thread can be used by others to also express their gratitude for [all] your efforts. I know full well you do not get enough praise.

Thank You Very Much!

pat
:)

Commented Unassigned: various System.ObjectDisposedException [1944]

$
0
0
during a long connection I get following exceptions:

```
System.ObjectDisposedException: Das SafeHandle wurde geschlossen.
bei Renci.SshNet.Session.WaitHandle(WaitHandle waitHandle) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Session.cs:Zeile 642.
bei Renci.SshNet.Channels.Channel.WaitHandle(WaitHandle waitHandle) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Channels\Channel.cs:Zeile 496.
bei Renci.SshNet.Channels.ChannelSession.Open() in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Channels\ChannelSession.cs:Zeile 52.
bei Renci.SshNet.ShellStream..ctor(Session session, String terminalName, UInt32 columns, UInt32 rows, UInt32 width, UInt32 height, Int32 maxLines, IDictionary`2 terminalModeValues) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\ShellStream.cs:Zeile 73.
bei Renci.SshNet.SshClient.CreateShellStream(String terminalName, UInt32 columns, UInt32 rows, UInt32 width, UInt32 height, Int32 bufferSize, IDictionary`2 terminalModeValues) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\SshClient.cs:Zeile 384.
bei Renci.SshNet.SshClient.CreateShellStream(String terminalName, UInt32 columns, UInt32 rows, UInt32 width, UInt32 height, Int32 bufferSize) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\SshClient.cs:Zeile 366.
```

and

```
System.ObjectDisposedException: Das SafeHandle wurde geschlossen.
bei System.Runtime.InteropServices.SafeHandle.DangerousAddRef(Boolean& success)
bei Microsoft.Win32.Win32Native.SetEvent(SafeWaitHandle handle)
bei System.Threading.EventWaitHandle.Set()
bei Renci.SshNet.ShellStream.Channel_DataReceived(Object sender, ChannelDataEventArgs e) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\ShellStream.cs:Zeile 739.
bei Renci.SshNet.Channels.Channel.OnData(Byte[] data) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Channels\Channel.cs:Zeile 289.
bei Renci.SshNet.Channels.Channel.OnChannelData(Object sender, MessageEventArgs`1 e) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Channels\Channel.cs:Zeile 590.
bei System.EventHandler`1.Invoke(Object sender, TEventArgs e)
bei Renci.SshNet.Session.OnChannelDataReceived(ChannelDataMessage message) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Session.cs:Zeile 1392.
bei Renci.SshNet.Session.HandleMessage(ChannelDataMessage message) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Session.cs:Zeile 1034.
bei CallSite.Target(Closure , CallSite , Session , Object )
bei Renci.SshNet.Session.HandleMessageCore(Message message) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Session.NET40.cs:Zeile 20.
bei Renci.SshNet.Session.MessageListener() in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Session.cs:Zeile 1589.
```

The application opens a ssh connection and opens/parses a ShellStream every 10 seconds.
IsConnected stays true.

I currently can't test the current beta since it has issues with closing the channel after
disposing the ShellStream.

No errors or unusual log entries on the server side.
Comments: ** Comment from web user: drieseng **

Please submit a new issue for the IsConnected problem.
If there are other weird exceptions/race, then you can create a separate issue for those (and if necessary I'll split them up into separate issues).

New Post: Proposal: Switching to GIT?

$
0
0
da_rinkes wrote:
I tried the tools git-svn and svn2git, but both failed to transform the repo.
Apperantly cause codeplex is not using a 100% standard svn.
I'm willing to bet it has to do with TeamFoundation being the repository used by CodePlex (Microsoft) here. I have to use VisualSVN in Visual Studio to use SVN, and I can't imagine Microsoft, which sells TF through upgrades to VS, is too keen on making their product work on less expensive alternatives. Which is an odd thing, especially if you see this, which reads:
You can use Visual Studio and Git to collaborate with your team using Team Foundation Server (on-premises or in the cloud), on CodePlex, or on a third-party service such as GitHub or Bitbucket.
Moving to a more functional GIT-based repository is a great idea, and there are lots of places to do so.

pat
:)

New Post: on cisco router no response after send Enable

$
0
0
All right Pat, da_rinkes,

Perhaps you wonder what I'm working at. I have a system, in use for some 10 years now to, by which people can perform settings on switches/routers.
Up to now I used external programs to do the actual communication to the switches. I want to have more control and not to depend on these programs.

I've created a class hierarchy switchSession and switchSshSession to handle sending a script containing commands and expected results to a switch/router.

Perhaps it's of some use to somebody else.

Base class switchSession
    ' Class switchSession is the base class for switchSshSession.
    '
    ' A switch session is the execution of a (text) script. The script contains alternating WAIT and SEND lines:
    '   WAIT "expected response"
    '   SEND "command"
    ' This format of SEND and WAIT commands has been in use for a long time and is constructed by the front-end
    ' application. The classes in this file implement the execution of such scripts.
    '
    ' example:
    '
    '192.168.88.238
    'Wait "Username:"
    'SEND "******@******\m"
    'WAIT "Password:"
    'SEND "*********\m"
    'wait ">"
    'SEND "enable\m"
    'WAIT "Password:"
    'SEND "********\m"
    'wait "#"
    'send "terminal length 0\m"
    'wait "#"
    'send "show mac-address-table vlan 1\m"
    'wait "#"
    'send "exit\m"

    Class switchSession
        ' base class switchSession
        Protected ClientIP As String = Nothing          ' ip address
        Protected ClientEndPort As IPEndPoint = Nothing
        Protected ClientResponseWait As Integer = 0     ' wait time (ms) to wait for response after sending a command
        Protected ClientResponseRetries As Integer = 0  ' nr of allowed retries when ScriptWait value is not (yet) received
        Protected ClientResponse As String = ""         ' responses received from the switch
        Protected ClientUsername As String = ""         ' username
        Protected ClientPassword As String = ""         ' password
        Protected ClientPort As Integer = 0             ' port (23: telnet, 22: ssh)
        Protected ClientDisplayscript As String = ""    ' password and username less version of the scriptText
        Protected sessionIOindex As Integer             ' index in send and wait
        Protected ScriptSend() As String                ' commands to send
        Protected ScriptWait() As String                ' expected responses
        Protected ClientValid As Boolean = False
        Protected sessionStatus As String = ""
        Public Sub New(scriptText As String, ResponseWait As Integer, ResponseRetries As Integer)
            ' Main purpose of base class switchSession New constructor is to convert the scriptText with SEND and WAIT lines
            ' into ScriptSend and ScriptWait string array's.
            ' Along with building ScriptSend (from SEND lines) and ScriptWait (from WAIT lines) ClientDisplayscript is filled,
            ' which will contain all SEND en WAIT lines but with username and password replaced by "********" (to allow an
            ' username and password less version of the script to present to the user)

            Dim qSend As New Queue(Of String)
            Dim qWait As New Queue(Of String)
            Try
                sessionStatus = "parse scripttext"
                scriptText = Regex.Replace(scriptText, "Wait " & Chr(34), "", RegexOptions.IgnoreCase)  ' remove all "wait"'s
                scriptText = Regex.Replace(scriptText, "Send " & Chr(34), "", RegexOptions.IgnoreCase)  ' remove all "send"'s
                scriptText = scriptText.Replace("\m" & Chr(34), "")                                     ' remove all command-end strings: \m"
                scriptText = scriptText.Replace("\M" & Chr(34), "")
                scriptText = scriptText.Replace(Chr(34), "")                                            ' remove all "

                For Each aIOstring As String In scriptText.Split(Environment.NewLine)
                    If sessionIOindex = 0 Then ClientIP = aIOstring.Trim
                    If sessionIOindex = 2 Then ClientUsername = aIOstring.Trim
                    If sessionIOindex = 4 Then ClientPassword = aIOstring.Trim
                    If sessionIOindex Mod 2 = 0 Or sessionIOindex = 0 Then
                        qSend.Enqueue(aIOstring.Trim)               ' even = send "..."
                        ClientDisplayscript += aIOstring & Environment.NewLine
                    Else
                        qWait.Enqueue(aIOstring.ToLower.Trim)       ' odd = wait "..."
                        If sessionIOindex <> 4 And sessionIOindex <> 8 Then
                            ClientDisplayscript += aIOstring & Environment.NewLine
                        Else
                            ClientDisplayscript += "********" & Environment.NewLine
                        End If
                    End If
                    sessionIOindex += 1
                Next
                sessionStatus = sessionIOindex & " lines in scripttext, " & qSend.Count & " script commands " & qWait.Count & " expected prompts"
                ReDim ScriptSend(qSend.Count - 1)
                ReDim ScriptWait(qWait.Count - 1)
                Dim i As Integer = 0
                While qSend.Count > 0
                    ScriptSend(i) = qSend.Dequeue
                    i += 1
                End While
                i = 0
                While qWait.Count > 0
                    ScriptWait(i) = qWait.Dequeue
                    i += 1
                End While

                qSend.Clear()
                qWait.Clear()

                ClientResponseWait = ResponseWait
                ClientResponseRetries = ResponseRetries

                ClientValid = True
                sessionIOindex = 0

            Catch ex As Exception
                ClientValid = False
                sessionStatus += Environment.NewLine & ex.Message
            End Try

        End Sub
        Public Function ExecuteScript() As Boolean
            Return False
        End Function

        Public ReadOnly Property ScriptDisplay As String
            Get
                Return ClientDisplayscript
            End Get
        End Property
        Public ReadOnly Property ScripLog As String
            Get
                Return ClientResponse
            End Get
        End Property
        Public ReadOnly Property isValid() As Boolean
            Get
                Return ClientValid
            End Get
        End Property
        Public ReadOnly Property status() As String
            Get
                Return sessionStatus
            End Get
        End Property
        Public Sub Dispose()
            ClientDisplayscript = ""
            ClientResponse = ""
            Array.Clear(ScriptSend, 0, ScriptSend.Length)
            Array.Clear(ScriptWait, 0, ScriptWait.Length)
            ClientIP = ""
            ClientUsername = ""
            ClientPassword = ""
        End Sub
    End Class
continued below...
Viewing all 2955 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>