this code is HORRIBLE

This commit is contained in:
kayos@tcp.direct 2020-12-31 20:42:57 -08:00
parent 4b4419b8d6
commit e1032ddc4b
3 changed files with 9 additions and 35 deletions

@ -267,19 +267,22 @@ func ircbot() {
fmt.Println("[IRC][drinkin] New drinker! " + Sender)
drinkin = append(drinkin, Sender)
} else {
fmt.Println("[IRC][drinkin] Existing drinker " + Sender)
drinkyBoys = strings.Join(drinkin, " ")
Phone(c, Sender + "takes another swig ;D")
Phone(c, ".drinkin: " + drinkyBoys)
drinkyBoys = strings.Replace(drinkyBoys, "nil ", "", -1)
Phone(c, Sender + " takes another swig ;D")
Phone(c, " ------> " + drinkyBoys)
return
}
ircDrinkin(c)
Phone(c,drinkyBoys)
drinkyBoys = strings.Join(drinkin," ")
Phone(c," ------> "+drinkyBoys)
case ".sober":
if contains(drinkin,Sender) {
for i, v := range drinkin {
if v == Sender {
rmKey(drinkin, i)
drinkin[i] = "nil"
}
}
}

@ -1,26 +0,0 @@
from __future__ import absolute_import, division
import cowrie.core.cef
import cowrie.core.output
from cowrie.core.config import CowrieConfig
class Output(cowrie.core.output.Output):
"""
sh0rtbus fifo output
"""
def start(self):
self.format = CowrieConfig().get('output_sh0rtbus', 'format')
def stop(self):
pass
def write(self, logentry):
if self.format == 'cef':
self.outfile.write('{0} '.format(logentry['timestamp']))
self.outfile.write('{0}\n'.format(cowrie.core.cef.formatCef(logentry)))
else:
self.outfile = open(CowrieConfig().get('output_sh0rtbus', 'fifo'), 'w')
self.outfile.write('{0}\n'.format(logentry['message']))
self.outfile.close()

@ -20,7 +20,7 @@ func conBanner() {
func contains(s []string, v string) bool {
for _, a := range s {
if a == v {
return true
return true
}
}
return false
@ -30,6 +30,3 @@ func printSlice(s []string) {
fmt.Printf("len=%d cap=%d %v\n", len(s), cap(s), s)
}
func rmKey(s []string, index int) []string {
return append(s[:index], s[index+1:]...)
}