Set Attribute Mode <ESC>[{attr1};...;{attrn}m
Sets multiple display attribute settings. The following lists standard attributes:
0 Reset all attributes
1 Bright
2 Dim
4 Underscore
5 Blink
7 Reverse
8 Hidden
Foreground Colours
30 Black
31 Red
32 Green
33 Yellow
34 Blue
35 Magenta
36 Cyan
37 White
Background Colours
40 Black
41 Red
42 Green
43 Yellow
44 Blue
45 Magenta
46 Cyan
47 White
*/
}
var gfb []byte
var UpdateScreenNow chan bool
var Pulling sync.Mutex
func StartPollingGDB() {
UpdateScreenNow = make(chan bool)
gfb = make([]byte, 0)
nic, err := net.Dial("tcp", "localhost:1234")
LazyHandle(err)
for {
select {
case <-time.After(time.Second):
Poll(nic)
case <-UpdateScreenNow:
Poll(nic)
}
}
}
func Poll(nic net.Conn) {
Pulling.Lock()
SendCMD(nic, "$g#67")
for i := 0; i < 2; i++ {
if i == 0 {
SendCMD(nic, "$mb8000,800#5b") // BIOS Framebuffer ranges
} else {
SendCMD(nic, "$mb8800,7a0#93") // BIOS Framebuffer ranges
}
time.Sleep(time.Millisecond * 100) // You may be able to lower this
}
SendCMD(nic, "$k#6b")
Pulling.Unlock()
}
_, err := nic.Write([]byte(payload))
LazyHandle(err)
in, err := nic.Read(buffer)
LazyHandle(err)
// Because I can't seem to figure out WHEN GDB is going to send stuff
// I have to do what you are seeing below, Because the other commands
// I am executing don't go above 1000 bytes output, I can presume that
// anything above 1000 chars is the results of my memory dump. This
// does mean however that we can get a out of order terminal, and that
// does suck, but until I can figure out how to get a consistant output
// it will have to stay like this.
if in > 1000 {
printtext(buffer, in)
}
* Get a DOS compatible floppy disk image (e.g. from here: http://www.allbootdisks.com/download/dos.html)
* Install golang and qemu, e.g. `sudo apt-get install qemu golang`
* Compile dos_ssh: `go get; go build`
* Start qemu with this image: `qemu-system-i386 -fda Dos6.22.img -boot a -vnc :0 -s`
* Run dos_ssh: `./dos_ssh`
* Connect to ssh server: `ssh localhost -p 2222`作者: zzz19760225 时间: 2016-10-21 23:25 标题: 2274.7z_server_5~7
for in := range Keyin {
// We lock here to ensure that we are not about to lock over the key input
Pulling.Lock()
if in == "\r" || in == "\n" { // Enter
vncconn.KeyEvent(uint32(0xFF0D), true)
vncconn.KeyEvent(uint32(0xFF0D), false)
} else if uint8([]byte(in)[0]) == 127 { // Backspace
vncconn.KeyEvent(uint32(0xFF08), true)
vncconn.KeyEvent(uint32(0xFF08), false)
} else {
vncconn.KeyEvent(uint32([]byte(in)[0]), true)
vncconn.KeyEvent(uint32([]byte(in)[0]), false)
}
time.Sleep(time.Millisecond * 25) // Time I would take to wait for input and other stuff
Pulling.Unlock()
}
}
[ Last edited by zzz19760225 on 2016-10-21 at 23:26 ]作者: zzz19760225 时间: 2016-10-21 23:27 标题: 2274.7z_ssh_6~7
listener, err := net.Listen("tcp", "0.0.0.0:2222")
if err != nil {
log.Fatalln("Could not start TCP listening on 0.0.0.0:2222")
}
log.Println("Waiting for TCP conns on 0.0.0.0:2222")
for {
nConn, err := listener.Accept()
if err != nil {
log.Println("WARNING - Failed to Accept TCP conn. RSN: %s / %s", err.Error(), err)
continue
}
go HandleIncomingSSHConn(nConn, SSHConfig)
}
}
// Wait 10 seconds before closing the connection (To stop dead connections)
func TimeoutConnection(Done chan bool, nConn net.Conn) {
select {
case <-Done:
return
case <-time.After(time.Second * 10):
nConn.Close()
}
}
func HandleIncomingSSHConn(nConn net.Conn, config *ssh.ServerConfig) {
DoneCh := make(chan bool)
go TimeoutConnection(DoneCh, nConn)
_, chans, reqs, err := ssh.NewServerConn(nConn, config)
if err == nil {
DoneCh <- true
}
// Right now that we are out of annoying people land.
defer nConn.Close()
go HandleSSHrequests(reqs)
for newChannel := range chans {
if newChannel.ChannelType() != "session" {
newChannel.Reject(ssh.UnknownChannelType, "unknown channel type")
log.Printf("WARNING - Rejecting %s Because they asked for a chan type %s that I don't have", nConn.RemoteAddr().String(), newChannel.ChannelType())
continue
}
channel, requests, err := newChannel.Accept()
if err != nil {
log.Printf("WARNING - Was unable to Accept channel with %s", nConn.RemoteAddr().String())
return
}
go HandleSSHrequests(requests)
go ServeDOSTerm(channel)
}
}
func HandleSSHrequests(in <-chan *ssh.Request) {
for req := range in {
if req.WantReply {
// Ensure that the other end does not panic that we don't offer terminals
if req.Type == "shell" || req.Type == "pty-req" {
req.Reply(true, nil)
} else {
req.Reply(false, nil)
}
}
}
}作者: zzz19760225 时间: 2016-10-21 23:28 标题: 2274.7z_util_7~7