mirror of
https://github.com/bettercap/bettercap
synced 2025-08-20 13:33:21 -07:00
misc: small fix or general refactoring i did not bother commenting
This commit is contained in:
parent
6af2de6de9
commit
76e094f687
8 changed files with 733 additions and 679 deletions
44
modules/zerogod/zerogod_ipp_validate_job.go
Normal file
44
modules/zerogod/zerogod_ipp_validate_job.go
Normal file
|
@ -0,0 +1,44 @@
|
|||
package zerogod
|
||||
|
||||
import (
|
||||
"github.com/evilsocket/islazy/tui"
|
||||
"github.com/phin1x/go-ipp"
|
||||
)
|
||||
|
||||
func ippOnValidateJob(ctx *HandlerContext, ipp_req *ipp.Request) {
|
||||
jobName := "<unknown>"
|
||||
jobUUID := "<unknown>"
|
||||
jobUser := "<unknown>"
|
||||
|
||||
if value, found := ipp_req.OperationAttributes["job-name"]; found {
|
||||
jobName = value.(string)
|
||||
}
|
||||
|
||||
if value, found := ipp_req.OperationAttributes["requesting-user-name"]; found {
|
||||
jobUser = value.(string)
|
||||
}
|
||||
|
||||
if value, found := ipp_req.JobAttributes["job-uuid"]; found {
|
||||
jobUUID = value.(string)
|
||||
}
|
||||
|
||||
ctx.mod.Debug("validating job_name=%s job_uuid=%s job_user=%s", tui.Yellow(jobName), tui.Dim(jobUUID), tui.Green(jobUser))
|
||||
|
||||
ipp_resp := ipp.NewResponse(ipp.StatusOk, ipp_req.RequestId)
|
||||
|
||||
// https://tools.ietf.org/html/rfc2911 section 3.1.4.2 Response Operation Attributes
|
||||
ipp_resp.OperationAttributes["attributes-charset"] = []ipp.Attribute{
|
||||
{
|
||||
Value: "utf-8",
|
||||
Tag: ipp.TagCharset,
|
||||
},
|
||||
}
|
||||
ipp_resp.OperationAttributes["attributes-natural-language"] = []ipp.Attribute{
|
||||
{
|
||||
Value: "en",
|
||||
Tag: ipp.TagLanguage,
|
||||
},
|
||||
}
|
||||
|
||||
ippSendResponse(ctx, ipp_resp)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue