save work in progress

This commit is contained in:
Xavier Henner
2019-07-08 18:41:04 +02:00
parent cdaf0dd68d
commit 9dc7d19811
4 changed files with 242 additions and 9 deletions

View File

@@ -13,11 +13,18 @@ import (
// Server represents the server
type OpenVpnMgt struct {
Port string
buf *bufio.ReadWriter
connected bool
m sync.RWMutex
ret chan []string
Port string
buf *bufio.ReadWriter
connected bool
m sync.RWMutex
ret chan []string
vpnlogUrl string
mailRelay string
MailFrom string
CcPwnPassword string
pwnTemplate string
newAsTemplate string
syslog bool
}
// NewServer returns a pointer to a new server
@@ -94,8 +101,20 @@ func (s *OpenVpnMgt) ClientDisconnect(line string) {
}
func (s *OpenVpnMgt) ClientConnect(line string) {
msg := <-s.ret
log.Println(msg)
client := NewVPNSession("log in")
client.ParseSessionId(line)
infos := <-s.ret
client.ParseEnv(&infos)
// err, msg := s.sendCommand([]string{fmt.Sprintf("client-deny %d %d \"Need OTP\" \"CRV1:R:blabla:eC5oZW5uZXI=:OTP Code \"", client.cID, client.kID)})
// if err != nil {
// return
// }
// log.Println(msg)
}
func (s *OpenVpnMgt) handleConn(conn net.Conn) {
@@ -136,6 +155,8 @@ func (s *OpenVpnMgt) handleConn(conn net.Conn) {
switch {
// a new openvpn server is connected
case strings.HasPrefix(line, ">INFO"):
// command sucessfull, we can ignore
case strings.HasPrefix(line, ">SUCCESS: client-deny command succeeded"):
// new bloc for a disconnect event.
// We start the receiving handler, which will wait for the Channel message
@@ -154,6 +175,6 @@ func (s *OpenVpnMgt) handleConn(conn net.Conn) {
default:
response = append(response, line)
}
log.Print(line)
//log.Print(line)
}
}