Quantcast
Channel: Rebex Q&A Forum - Recent questions and answers
Viewing all 3878 articles
Browse latest View live

Answered: SSH private key + SFTP + Powershell... Any examples?

$
0
0

There are two samples on our blog, and I'm adding additional samples here.

This connects to our demo server, lists the root directory contents and downloads the readme.txt file:

# load Rebex SFTP assemblies
Add-Type -Path "c:\Program Files (x86)\Rebex Components 2017 R4.1\bin\net-4.0\Rebex.Common.dll" 
Add-Type -Path "c:\Program Files (x86)\Rebex Components 2017 R4.1\bin\net-4.0\Rebex.Networking.dll" 
Add-Type -Path "c:\Program Files (x86)\Rebex Components 2017 R4.1\bin\net-4.0\Rebex.Sftp.dll" 

# create an instance of Sftp object
$sftp = New-Object Rebex.Net.Sftp

# omit this if logging is not needed (or use FileLogWriter to log into a file)
$sftp.LogWriter = New-Object Rebex.ConsoleLogWriter([Rebex.LogLevel]::Info)

# connect and authenticate
$sftp.Connect("test.rebex.net")
$sftp.Login("demo", "password") 

# display contents of the root directory (use GetList to get a parsed form)
Write-Output $sftp.GetRawList("/")

# download a file into the current directory
$sftp.Download("/readme.txt", ".")

# disconnect from the server and dispose the sftp object
$sftp.Disconnect()
$sftp.Dispose()

To authenticate using a private key instead of a password, use create an instance of SshPrivateKey and use another overload of the Login method:

...
$key = New-Object Rebex.Net.SshPrivateKey("C:\MyData\Key.ppk", "keypassword")
$sftp.Login("username", $key) 
...

And to use both a key and password, use this:

...
$key = New-Object Rebex.Net.SshPrivateKey("C:\MyData\Key.ppk", "keypassword")
$sftp.Login("username", "password", $key) 
...

Most methods of the Sftp object are simple-to-use and quite suitable to be called from PowerShell scripts - converting the sample code from our features pages should be quite simple.


Three Ways To Keep Your Shop Searching Just Exposed

$
0
0
business entrepreneurstarting a business long time ago - some 5 years back to be precise I had an itch to scrape. I was being hit from all sides online with emails and popups declaring approaches to earn an income online. So with my curious mind we attempted to discover what type of job I could get on the web part time and not do much work with it.

Rebex HTTPS - support for WCF proxies using HttpChannelFactory

$
0
0

Hello,

I am trying out Rebex HTTPs for our Compact Framework.Net app. The app makes extensive use of WCF calls using proxies generated by the CF.Net version of svcutil.

I am using the HttpRequestCreator.Register() approach for registering the Rebex library. However, the WCF calls are getting an error inside the HTTPChannelFactory class with an InvalidCastException. The .Net HTTPChannelFactory.GetWebRequest method is expecting the return type of GetWebRequest to be HttpWebRequest. Since Rebex returns a HttpRequest, this is resulting in the casting exception. I am adding the stack trace at the end of this message.

Is there any alternative way of using HttpChannelFactory with Rebex, or plans to add support for this in the future ?

Thanks.

Subha Tarafdar.

Stack Trace returning InvalidCastException: 
at System.ServiceModel.Channels.HttpChannelFactory.GetWebRequest(EndpointAddress to, Uri via, TimeSpan timeout)
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.GetWebRequest(EndpointAddress to, Uri via, TimeoutHelper& timeoutHelper)
at System.ServiceModel.Channels.HttpsChannelFactory.HttpsRequestChannel.GetWebRequest(EndpointAddress to, Uri via, TimeoutHelper& timeoutHelper)
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.SendRequest(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.RequestChannel.Request(Message message)
at Microsoft.Tools.ServiceModel.CFClientBase`1.getReply(Message msg)
at Microsoft.Tools.ServiceModel.CFClientBase`1._Invoke[TREQUEST,TRESPONSE](CFInvokeInfo info, IsAvailableForSyncingRequest request)
at Microsoft.Tools.ServiceModel.CFClientBase`1.Invoke[TREQUEST,TRESPONSE](CFInvokeInfo info, IsAvailableForSyncingRequest request)

Stay At Home Mothers - Just How To Make Money Using House Without Sales

Chattercams or Chattercams.com is a Chaturbate Clone

$
0
0
We are commencing our Chattercams (or Chattercams.com) testimonial by discussing the fact that this is not a real parasitic webcam sex chat site and its prices really are a moot point as you're really redirected to some other site when you connect or login through the entire Chattercams Landing page.

Chattercams.com website is merely an online sex cam chat website using a real underlining adult sex webcams platform which is Chaturbate.com. Adult cam price ranges and the exhibited prices are irrelevant since they'll be always the exact same as at the authentic website (Chaturbate.com). Chattercams gets the exact hosts and the very same prices as Chaturbate. Chattercams.com and also Chaturbate.com are virtually exactly the identical web site but using distinct logo or alternative style.

Chattercams is also known as: chattercam.com, chatter cams and chatter cam. Chattercams.com is relatively a secure a reliable sex cam website. We have obtained any complaints so far. That isn't any harm in going to Chattercams, but why should you decide a replica if you can just go to the original website? Just click the button below and begin having a sex cam chat directly understand

After you register and sign in Chattercams.com, you're going to be redirected into the back of Chaturbate. In other words - it doesn't matter if you register or join through Chattercams or even Chaturbate, you'll arrive at the same dashboard, cover exactly the exact prices and talk with the same host.

Rather than visiting Chattercams, we recommend on reading about the initial web page - Chaturbate. If you'd like to see about the actual bargain, then you definitely better visit our Chaturbate inspection page. Find out all you could need to understand to possess the best adult webcam sex experience. Chaturbate is a trusted adult cam site. The truth is that we believe Chaturbate to be certainly one of many best cam blogs online.

Used Rebex trial to support TLS 1.2 in windows CE and failed.

$
0
0

Hi,
I downloaded RebexHttps-2017R2-Trial.exe to support TLS 1.2 in .net CF 3.5.
I did the adjustment but cannot log into https sites. My code is given bellow.

This was an existing code and i modified it to support TLS 1.2 based on the instructions given in Rebex site. But i feel i have missed something.

using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using Rebex.Net;
using Rebex.Security;


namespace myTest.WebService
{
    public partial class DATA_CAPTURE_MANAGEMENT : System.Web.Services.Protocols.SoapHttpClientProtocol
    {
        protected override System.Net.WebRequest GetWebRequest(Uri uri)
        {
            HttpRequestCreator creator;

            creator = new Rebex.Net.HttpRequestCreator();
            creator.Register();
            //creator.Settings.SslAllowedVersions = TlsVersion.TLS12 | TlsVersion.TLS11 | TlsVersion.TLS10;
            System.Net.WebRequest request = base.GetWebRequest(uri); 
            switch (uri.Scheme)
            {
                case "http":
                    request = creator.Create(uri);
                    break;
                case "https":
                    // use Rebex HttpRequest to handle HTTP and HTTPS requests
                    request = creator.Create(uri);
                    break;
                default:
                    // use default functionality to handle other requests
                    request = base.GetWebRequest(uri);
                    break;
            }

            if (PreAuthenticate)
            {
                System.Net.NetworkCredential networkCredentials = Credentials.GetCredential(uri, "Basic");
                request.Credentials = Credentials.GetCredential(uri, "Basic");
                if (networkCredentials != null)
                {
                    byte[] credentialBuffer = new System.Text.UTF8Encoding().GetBytes(
                    networkCredentials.UserName + ":" + networkCredentials.Password);
                    request.Headers.Add("Authorization", "Basic " + Convert.ToBase64String(credentialBuffer));
                }
                else
                {
                    throw new ApplicationException("No network credentials");
                }
            }
            if (myTest.Helpers.Configuration.CurrentCultureName != null)
            {
                request.Headers.Add("ACCEPT-LANGUAGE", myTest.Helpers.Configuration.CurrentCultureName);
            }  
            return request;
        }
    }
}

Does the Fileset class support Ant patterns

$
0
0

Our app uses ant file patterns for selecting files, does the FileSet class support these or do we need to create our own descendent?

Looking at the help, it looks like it may do, with ** support, just wondering if it's intended to support any ant pattern?

Object reference not set to an instance of an object.

$
0
0

So I know this is a pretty common problem and but it's showing itself in a very unique way. I have built a program that basically retrieves emails via IMAP and then resends them. I build the program originally in test format under a windows console program. It works perfect. I built a windows service project and have installed it successfully and have it running the code starting fine. The issue is the exact same code in windows service gives me the Object ref not set. I have tried everything that i can think of. Added right, installed the dlls in the GAC, put the files with the EXE. Below is the sample code. Any help would be greatly appreciated. The error code I'm catching is "Object reference not set to an instance of an object"

using imap As New Rebex.Net.Imap()

    Dim mydb As New mySqlDB
        mydb.executeDMLSQL("insert into o365pocdb.poc_log (server, type, data, POC) values ('"& Server & "','Perf-Log','POC Started','"& Username & "')", sresult)

        Try
            mydb.executeDMLSQL("insert into o365pocdb.poc_log (server, type, data, poc) values ('"& Server & "','error','connected fine',' ')", sresult)
            imap.Connect(hostname, SslMode.Implicit)
            imap.Login(Username, Password)
            imap.SelectFolder("Inbox")

        Catch ex As Exception
        'mydb.executeDMLSQL("insert into o365pocdb.poc_log (server, type, data, poc) values ('"& Server & "','error','"& ex.Message & "',' ')", sresult)
        mydb.executeDMLSQL("insert into o365pocdb.poc_log (server, type, data, poc) values ('"& Server & "','error','Going to exit sub - cant connct','"& ex.Message & "')", sresult)
        Exit Sub
    End Try

Answered: Does the Fileset class support Ant patterns

$
0
0

Hello,

I am not sure what you mean by ant file patterns other than using '**' in the path. You can use this 'wildcard' in both Include and Exclued methods, as you probably read at our file set feature page. It serves recursive search and matching file or directory deep in directory tree based at path provided to the FileSet constructor. If it doesn't suite you, you can create your own descendent, of course. How to implement it, please read this file set forum post for the start. It implements fileset based on regular expression, but you should be able to rewrite it to any ant pattern support as you need.

Remove a few Received headers

$
0
0

Hello,

How would I remove a few receive headers in an email? I can list them out fine but I can't figure out how to strip a few out. I'm a little confused as to how to leverage the removeat method of the HeaderValueCollection. Any help would be welcome.

Dim mail As MailMessage

    mail = imap.GetMailMessage(uniqID)

    For Each header In mail.Headers

            If header.Name Like "Received" Then
                If InStr(header.value.ToString, "prod.outlook.com") > 0 Then
                    MsgBox("Going to remove the header")
                    header.removeat(header)' This doesn't work
                End If

                MsgBox(header.Value.ToString)

            End If

Answered: A new feature that you should add.

$
0
0

This looks useful. However, the encryption would not be done in-place anyway (otherwise, if the app was terminated in the middle of encrypting a file, we would end up with half-encrypted file). That means that we would still have to do File.Delete(filename)+File.Move(encrypted, filename) afterwards (sadly, Windows doesn't support POSIX-like atomic rename).

We will consider this, but implanting a custom extension method for the FileEncryption class is the recommended solution for now.

Top Ideas To Purchase Your Fantasy Home In Kolkata

Object reference not set to an instance of an object.

$
0
0

So I know this is a pretty common problem and but it's showing itself in a very unique way. I have built a program that basically retrieves emails via IMAP and then resends them. I build the program originally in test format under a windows console program. It works perfect. I built a windows service project and have installed it successfully and have it running the code starting fine. The issue is the exact same code in windows service gives me the Object ref not set. I have tried everything that i can think of. Added right, installed the dlls in the GAC, put the files with the EXE. Below is the sample code. Any help would be greatly appreciated. The error code I'm catching is "Object reference not set to an instance of an object"

using imap As New Rebex.Net.Imap()

    Dim mydb As New mySqlDB
        mydb.executeDMLSQL("insert into o365pocdb.poc_log (server, type, data, POC) values ('"& Server & "','Perf-Log','POC Started','"& Username & "')", sresult)

        Try
            mydb.executeDMLSQL("insert into o365pocdb.poc_log (server, type, data, poc) values ('"& Server & "','error','connected fine',' ')", sresult)
            imap.Connect(hostname, SslMode.Implicit)
            imap.Login(Username, Password)
            imap.SelectFolder("Inbox")

        Catch ex As Exception
        'mydb.executeDMLSQL("insert into o365pocdb.poc_log (server, type, data, poc) values ('"& Server & "','error','"& ex.Message & "',' ')", sresult)
        mydb.executeDMLSQL("insert into o365pocdb.poc_log (server, type, data, poc) values ('"& Server & "','error','Going to exit sub - cant connct','"& ex.Message & "')", sresult)
        Exit Sub
    End Try

Top Suggestions To Buy Your Dream Home In Kolkata

Object reference not set to an instance of an object.

$
0
0

So I know this is a pretty common problem and but it's showing itself in a very unique way. I have built a program that basically retrieves emails via IMAP and then resends them. I build the program originally in test format under a windows console program. It works perfect. I built a windows service project and have installed it successfully and have it running the code starting fine. The issue is the exact same code in windows service gives me the Object ref not set. I have tried everything that i can think of. Added right, installed the dlls in the GAC, put the files with the EXE. Below is the sample code. Any help would be greatly appreciated. The error code I'm catching is "Object reference not set to an instance of an object"

using imap As New Rebex.Net.Imap()

    Dim mydb As New mySqlDB
        mydb.executeDMLSQL("insert into o365pocdb.poc_log (server, type, data, POC) values ('"& Server & "','Perf-Log','POC Started','"& Username & "')", sresult)

        Try
            mydb.executeDMLSQL("insert into o365pocdb.poc_log (server, type, data, poc) values ('"& Server & "','error','connected fine',' ')", sresult)
            imap.Connect(hostname, SslMode.Implicit)
            imap.Login(Username, Password)
            imap.SelectFolder("Inbox")

        Catch ex As Exception
        'mydb.executeDMLSQL("insert into o365pocdb.poc_log (server, type, data, poc) values ('"& Server & "','error','"& ex.Message & "',' ')", sresult)
        mydb.executeDMLSQL("insert into o365pocdb.poc_log (server, type, data, poc) values ('"& Server & "','error','Going to exit sub - cant connct','"& ex.Message & "')", sresult)
        Exit Sub
    End Try

"Bad message" error

$
0
0

We get the following errors when connecting to an SFTP server. Any ideas?

Exception Type: Rebex.Net.SftpException
Message: Bad message; Bad message.
Method that threw an exception:
Void EC(Rebex.Net.SDB, System.Type)
Assembly: Rebex.Sftp
StackTrace:
at Rebex.Net.YEB.EC(SDB A, Type B)
at Rebex.Net.YEB.HB(String A, VFB B, Boolean C, BEB D)
at Rebex.Net.Sftp.XAB(BEB A, String B, Stream C, Int64 D, Int64 E, WCB H)
at Rebex.Net.Sftp.XAB(FileMode A, BEB B, String C, String D, Int64 E, Int64 H, Int64 I, WCB J)
at Rebex.Net.Sftp.WAB(FileMode A, String B, String C, Int64 D, Int64 E, Int64 H, WCB I)
at Rebex.Net.Sftp.GetFile(String remotePath, String localPath)
at Rebex.Net.FileTransferClient.GetFile(String remotePath, String localPath)

Answered: File priority in Rebex FTPS

$
0
0

Unfortunately, there is no such feature as file priority. Sorry.

Your solution is the correct one.
If you have more .SFV files to be uploaded, you can use FileSet class to easily select them:

var sfvFiles = new FileSet("c:/data");
sfvFiles.Include("*.sfv", TraversalMode.MatchFilesDeep);

// upload all .SFV files first
client.Upload(sfvFiles, "/data");

var otherFiles = new FileSet("c:/data");
otherFiles.Include("*");
otherFiles.Exclude("*.sfv", TraversalMode.MatchFilesDeep);

// upload other files
client.Upload(otherFiles, "/data");

SMTP: Rebex.Net.SmtpException: An existing connection was forcibly closed by the remote host.

$
0
0

We send mail from two different modules. One is while configuration/setup and another is when you select the file and send mail to addresses.

Configuration is success. But actual send mail is failing.

wireshark network trace says:
93 34.113000 IPADDRESS1 IPADDRESS2 SMTP 100 [TCP Spurious Retransmission] S: 354 Start mail input; end with .

Actual exception:
2017-08-31 17:01:38 ERROR Smtp(4) Info: Rebex.Net.SmtpException: An existing connection was forcibly closed by the remote host ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
at System.Net.Sockets.Socket.ReceiveNoCheck(Byte[] buffer, Int32 index, Int32 request, SocketFlags socketFlags)
at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
at Rebex.Net.ProxySocket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
at Rebex.Net.SmtpSocket.Receive()
at Rebex.Net.SmtpSocket.ReadLine(String& response)
at Rebex.Net.SmtpSocket.Read()
at Rebex.Net.Smtp.ReadResponse(Int32 success, Boolean blocking)
at Rebex.Net.Smtp.SendData(StuffingStream ss)
at Rebex.Net.Smtp.SendPipelining(Boolean chunking, String[] to, StuffingStream ss, String rcptToParameters)
at Rebex.Net.Smtp.SendInternalInner(String from, String[] to, String envelopeID, Stream message)
at Rebex.Net.Smtp.SendInternal(MimeMessage mail, Stream input, MailAddress sender, MailAddressCollection to)
at Rebex.Net.Smtp.Send(MailMessage mail, String sender, String recipients)
at Rebex.Net.Smtp.Send(MailMessage mail)
at System.Reflection.RuntimeMethodInfo.InternalInvoke(RuntimeMethodInfo rtmi, Object obj, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture, Boolean isBinderDefault, Assembly caller, Boolean verifyAccess, StackCrawlMark& stackMark)
at System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean verifyAccess, StackCrawlMark& stackMark)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at Rebex.Net.RebexAsyncResult.Runner()
at Rebex.Net.RebexAsyncResult.SimpleThreadPool.Runner()

at Rebex.Net.Smtp.ReadResponse(Int32 success, Boolean blocking)
at Rebex.Net.Smtp.SendData(StuffingStream ss)
at Rebex.Net.Smtp.SendPipelining(Boolean chunking, String[] to, StuffingStream ss, String rcptToParameters)
at Rebex.Net.Smtp.SendInternalInner(String from, String[] to, String envelopeID, Stream message)
at Rebex.Net.Smtp.SendInternal(MimeMessage mail, Stream input, MailAddress sender, MailAddressCollection to)
at Rebex.Net.Smtp.Send(MailMessage mail, String sender, String recipients)
at Rebex.Net.Smtp.Send(MailMessage mail)
at System.Reflection.RuntimeMethodInfo.InternalInvoke(RuntimeMethodInfo rtmi, Object obj, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture, Boolean isBinderDefault, Assembly caller, Boolean verifyAccess, StackCrawlMark& stackMark)
at System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean verifyAccess, StackCrawlMark& stackMark)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at Rebex.Net.RebexAsyncResult.Runner()
at Rebex.Net.RebexAsyncResult.SimpleThreadPool.Runner()

Answered: SMTP: Rebex.Net.SmtpException: An existing connection was forcibly closed by the remote host.

$
0
0

Some server have been observed to have troubles with SMTP's "pipelining" and "chunking" extensions. Please try to disable them before calling the Send method and let us know whether this has any effect:

smtp.EnabledExtensions &= ~(SmtpExtensions.Pipelining | SmtpExtensions.Chunking);
smtp.Send(...);

Support for Signature algorithm RSASSA-PSS

$
0
0

Are you planning on implementing support for the Signature algorithm RSASSA-PSS (as per IETF RFC 4056)in SecureMail before the end of 2017?

This will be a mandatory requirement here in Germany as of 1st January 2018.

Viewing all 3878 articles
Browse latest View live