Skip to content

Commit

Permalink
work in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
nl5887 committed Jun 17, 2018
1 parent ee831a8 commit b990240
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 1 deletion.
2 changes: 1 addition & 1 deletion services/rdp/rdp.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ func (s *rdpService) Handle(ctx context.Context, conn net.Conn) error {
}

// COTP
b, err = rdr.Peek(1)
b, err := rdr.Peek(1)
if err != nil {
return err
}
Expand Down
65 changes: 65 additions & 0 deletions services/rdp/rdp_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
* Honeytrap
* Copyright (C) 2016-2017 DutchSec (https://dutchsec.com/)
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License
* version 3 along with this program in the file "LICENSE". If not, see
* <http://www.gnu.org/licenses/agpl-3.0.txt>.
*
* See https://honeytrap.io/ for more details. All requests should be sent to
* licensing@honeytrap.io
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* Honeytrap" logo and retain the original copyright notice. If the display of the
* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
* must display the words "Powered by Honeytrap" and retain the original copyright notice.
*/
package rdp

import (
"bytes"
"context"
"net"
"testing"
)

func TestRDP_Connect(t *testing.T) {
server, client := net.Pipe()
defer server.Close()
defer client.Close()

c := RDP()

go c.Handle(context.TODO(), server)

test := []byte("test")
if _, err := client.Write(test); err != nil {
t.Error(err)
}

buffer := make([]byte, 255)
if n, err := client.Read(buffer[:]); err != nil {
t.Error(err)
} else {
buffer = buffer[:n]
}

if !bytes.Equal(test, buffer) {
t.Errorf("Test failed: got %+#v, expected %+#v", buffer, test)
return
}
}

0 comments on commit b990240

Please sign in to comment.