mirror of
https://github.com/bettercap/bettercap
synced 2025-08-22 06:23:18 -07:00
feat(RDP): RDP-Proxy prototype.
This commit is contained in:
parent
1e7df0ae28
commit
f00ad86646
7 changed files with 136 additions and 135 deletions
|
@ -1,39 +0,0 @@
|
||||||
package packet_proxy
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/bettercap/bettercap/session"
|
|
||||||
)
|
|
||||||
|
|
||||||
type PacketProxy struct {
|
|
||||||
session.SessionModule
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewPacketProxy(s *session.Session) *PacketProxy {
|
|
||||||
return &PacketProxy{
|
|
||||||
SessionModule: session.NewSessionModule("packet.proxy", s),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (mod PacketProxy) Name() string {
|
|
||||||
return "packet.proxy"
|
|
||||||
}
|
|
||||||
|
|
||||||
func (mod PacketProxy) Description() string {
|
|
||||||
return "Not supported on this OS"
|
|
||||||
}
|
|
||||||
|
|
||||||
func (mod PacketProxy) Author() string {
|
|
||||||
return "Simone Margaritelli <evilsocket@gmail.com>"
|
|
||||||
}
|
|
||||||
|
|
||||||
func (mod *PacketProxy) Configure() (err error) {
|
|
||||||
return session.ErrNotSupported
|
|
||||||
}
|
|
||||||
|
|
||||||
func (mod *PacketProxy) Start() error {
|
|
||||||
return session.ErrNotSupported
|
|
||||||
}
|
|
||||||
|
|
||||||
func (mod *PacketProxy) Stop() error {
|
|
||||||
return session.ErrNotSupported
|
|
||||||
}
|
|
|
@ -1,41 +0,0 @@
|
||||||
// +build !amd64
|
|
||||||
|
|
||||||
package packet_proxy
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/bettercap/bettercap/session"
|
|
||||||
)
|
|
||||||
|
|
||||||
type PacketProxy struct {
|
|
||||||
session.SessionModule
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewPacketProxy(s *session.Session) *PacketProxy {
|
|
||||||
return &PacketProxy{
|
|
||||||
SessionModule: session.NewSessionModule("packet.proxy", s),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (mod PacketProxy) Name() string {
|
|
||||||
return "packet.proxy"
|
|
||||||
}
|
|
||||||
|
|
||||||
func (mod PacketProxy) Description() string {
|
|
||||||
return "Not supported on this OS"
|
|
||||||
}
|
|
||||||
|
|
||||||
func (mod PacketProxy) Author() string {
|
|
||||||
return "Simone Margaritelli <evilsocket@gmail.com>"
|
|
||||||
}
|
|
||||||
|
|
||||||
func (mod *PacketProxy) Configure() (err error) {
|
|
||||||
return session.ErrNotSupported
|
|
||||||
}
|
|
||||||
|
|
||||||
func (mod *PacketProxy) Start() error {
|
|
||||||
return session.ErrNotSupported
|
|
||||||
}
|
|
||||||
|
|
||||||
func (mod *PacketProxy) Stop() error {
|
|
||||||
return session.ErrNotSupported
|
|
||||||
}
|
|
|
@ -1,39 +0,0 @@
|
||||||
package packet_proxy
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/bettercap/bettercap/session"
|
|
||||||
)
|
|
||||||
|
|
||||||
type PacketProxy struct {
|
|
||||||
session.SessionModule
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewPacketProxy(s *session.Session) *PacketProxy {
|
|
||||||
return &PacketProxy{
|
|
||||||
SessionModule: session.NewSessionModule("packet.proxy", s),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (mod PacketProxy) Name() string {
|
|
||||||
return "packet.proxy"
|
|
||||||
}
|
|
||||||
|
|
||||||
func (mod PacketProxy) Description() string {
|
|
||||||
return "Not supported on this OS"
|
|
||||||
}
|
|
||||||
|
|
||||||
func (mod PacketProxy) Author() string {
|
|
||||||
return "Simone Margaritelli <evilsocket@gmail.com>"
|
|
||||||
}
|
|
||||||
|
|
||||||
func (mod *PacketProxy) Configure() (err error) {
|
|
||||||
return session.ErrNotSupported
|
|
||||||
}
|
|
||||||
|
|
||||||
func (mod *PacketProxy) Start() error {
|
|
||||||
return session.ErrNotSupported
|
|
||||||
}
|
|
||||||
|
|
||||||
func (mod *PacketProxy) Stop() error {
|
|
||||||
return session.ErrNotSupported
|
|
||||||
}
|
|
39
modules/rdp_proxy/rdp_proxy_darwin.go
Normal file
39
modules/rdp_proxy/rdp_proxy_darwin.go
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
package rdp_proxy
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/bettercap/bettercap/session"
|
||||||
|
)
|
||||||
|
|
||||||
|
type RdpProxy struct {
|
||||||
|
session.SessionModule
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewRdpProxy(s *session.Session) *RdpProxy {
|
||||||
|
return &RdpProxy{
|
||||||
|
SessionModule: session.NewSessionModule("rdp.proxy", s),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (mod RdpProxy) Name() string {
|
||||||
|
return "rdp.proxy"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (mod RdpProxy) Description() string {
|
||||||
|
return "Not supported on this OS"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (mod RdpProxy) Author() string {
|
||||||
|
return "Alexandre Beaulieu <alex@segfault.me>"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (mod *RdpProxy) Configure() (err error) {
|
||||||
|
return session.ErrNotSupported
|
||||||
|
}
|
||||||
|
|
||||||
|
func (mod *RdpProxy) Start() error {
|
||||||
|
return session.ErrNotSupported
|
||||||
|
}
|
||||||
|
|
||||||
|
func (mod *RdpProxy) Stop() error {
|
||||||
|
return session.ErrNotSupported
|
||||||
|
}
|
41
modules/rdp_proxy/rdp_proxy_linux.go
Normal file
41
modules/rdp_proxy/rdp_proxy_linux.go
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
// +build !amd64
|
||||||
|
|
||||||
|
package rdp_proxy
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/bettercap/bettercap/session"
|
||||||
|
)
|
||||||
|
|
||||||
|
type RdpProxy struct {
|
||||||
|
session.SessionModule
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewRdpProxy(s *session.Session) *RdpProxy {
|
||||||
|
return &RdpProxy{
|
||||||
|
SessionModule: session.NewSessionModule("rdp.proxy", s),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (mod RdpProxy) Name() string {
|
||||||
|
return "rdp.proxy"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (mod RdpProxy) Description() string {
|
||||||
|
return "Not supported on this OS"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (mod RdpProxy) Author() string {
|
||||||
|
return "Alexandre Beaulieu <abeaulieu@gosecure.net>"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (mod *RdpProxy) Configure() (err error) {
|
||||||
|
return session.ErrNotSupported
|
||||||
|
}
|
||||||
|
|
||||||
|
func (mod *RdpProxy) Start() error {
|
||||||
|
return session.ErrNotSupported
|
||||||
|
}
|
||||||
|
|
||||||
|
func (mod *RdpProxy) Stop() error {
|
||||||
|
return session.ErrNotSupported
|
||||||
|
}
|
|
@ -13,9 +13,6 @@ import (
|
||||||
"github.com/chifflier/nfqueue-go/nfqueue"
|
"github.com/chifflier/nfqueue-go/nfqueue"
|
||||||
"github.com/google/gopacket"
|
"github.com/google/gopacket"
|
||||||
"github.com/google/gopacket/layers"
|
"github.com/google/gopacket/layers"
|
||||||
|
|
||||||
// "github.com/evilsocket/islazy/fs"
|
|
||||||
// "github.com/evilsocket/islazy/tui"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type RdpProxy struct {
|
type RdpProxy struct {
|
||||||
|
@ -73,16 +70,6 @@ func (mod RdpProxy) Author() string {
|
||||||
return "Alexandre Beaulieu <alex@segfault.me>"
|
return "Alexandre Beaulieu <alex@segfault.me>"
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mod *RdpProxy) destroyQueue() {
|
|
||||||
if mod.queue == nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
mod.queue.DestroyQueue()
|
|
||||||
mod.queue.Close()
|
|
||||||
mod.queue = nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Adds the firewall rule for proxy instance.
|
// Adds the firewall rule for proxy instance.
|
||||||
func (mod *RdpProxy) doProxy(addr string, port string, enable bool) (err error) {
|
func (mod *RdpProxy) doProxy(addr string, port string, enable bool) (err error) {
|
||||||
_, err = core.Exec("iptables", []string { "-t", "nat",
|
_, err = core.Exec("iptables", []string { "-t", "nat",
|
||||||
|
@ -225,12 +212,26 @@ func (mod *RdpProxy) Start() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mod *RdpProxy) Stop() error {
|
func (mod *RdpProxy) Stop() error {
|
||||||
for _, cmd := range mod.active {
|
|
||||||
cmd.Process.Kill() // FIXME: More graceful way to shutdown?
|
|
||||||
}
|
|
||||||
return mod.SetRunning(false, func() {
|
return mod.SetRunning(false, func() {
|
||||||
mod.queue.StopLoop()
|
mod.queue.StopLoop()
|
||||||
mod.configureFirewall(false)
|
mod.configureFirewall(false)
|
||||||
|
for _, cmd := range mod.active {
|
||||||
|
cmd.Process.Kill() // FIXME: More graceful way to shutdown proxy agents?
|
||||||
|
}
|
||||||
|
|
||||||
<-mod.done
|
<-mod.done
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (mod *RdpProxy) destroyQueue() {
|
||||||
|
if mod.queue == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
mod.queue.DestroyQueue()
|
||||||
|
mod.queue.Close()
|
||||||
|
mod.queue = nil
|
||||||
|
}
|
||||||
|
|
||||||
|
|
39
modules/rdp_proxy/rdp_proxy_windows.go
Normal file
39
modules/rdp_proxy/rdp_proxy_windows.go
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
package rdp_proxy
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/bettercap/bettercap/session"
|
||||||
|
)
|
||||||
|
|
||||||
|
type RdpProxy struct {
|
||||||
|
session.SessionModule
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewRdpProxy(s *session.Session) *RdpProxy {
|
||||||
|
return &RdpProxy{
|
||||||
|
SessionModule: session.NewSessionModule("rdp.proxy", s),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (mod RdpProxy) Name() string {
|
||||||
|
return "rdp.proxy"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (mod RdpProxy) Description() string {
|
||||||
|
return "Not supported on this OS"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (mod RdpProxy) Author() string {
|
||||||
|
return "Alexandre Beaulieu <alex@segfault.me>"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (mod *RdpProxy) Configure() (err error) {
|
||||||
|
return session.ErrNotSupported
|
||||||
|
}
|
||||||
|
|
||||||
|
func (mod *RdpProxy) Start() error {
|
||||||
|
return session.ErrNotSupported
|
||||||
|
}
|
||||||
|
|
||||||
|
func (mod *RdpProxy) Stop() error {
|
||||||
|
return session.ErrNotSupported
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue