shadow1ng/fscan · error

%s (webscan_afrog_no_rules)

Error message

%s (webscan_afrog_no_rules)

What it means

The afrog ToFscanPoc conversion throws webscan_afrog_no_rules when, after iterating the afrog POC's payloads/rules, no fscan rules could be generated. Returning an empty-rules POC would be useless, so the converter fails explicitly.

Source

Thrown at webscan/lib/poc_adapter.go:599

			FollowRedirects: rule.Request.FollowRedirects,
			Expression:      rule.Expression,
		}

		// 转换 output 字段为 Search — 多步POC中从响应提取变量供后续步骤使用
		if searchVal, ok := rule.Output["search"]; ok {
			fscanRule.Search = fmt.Sprintf("%v", searchVal)
		}

		// 如果expression为空,默认检查200状态码
		if fscanRule.Expression == "" {
			fscanRule.Expression = "response.status == 200"
		}

		poc.Rules = append(poc.Rules, fscanRule)
	}

	if len(poc.Rules) == 0 {
		return nil, fmt.Errorf("%s", i18n.GetText("webscan_afrog_no_rules"))
	}

	return poc, nil
}

View on GitHub (pinned to 95cc12e753)

Solutions

  1. Ensure the afrog POC contains a populated rules/sets section before conversion
  2. Check the converter's supported expression constructs and simplify unsupported ones
  3. Skip or flag POCs that yield zero rules instead of assuming conversion always succeeds
  4. Update the POC source to a version compatible with this library's converter

Example fix

// before
rules, err := adapter.ToFscanPoc()
// after
if len(adapter.Poc.Rules) == 0 {
    return // nothing convertible
}
rules, err := adapter.ToFscanPoc()
Defensive patterns

Strategy: validation

Validate before calling

if len(afrogPoc.Rules) == 0 {
    return errors.New("afrog POC has no convertible rules")
}

Type guard

func hasAfrogRules(a *lib.AfrogPocAdapter) bool {
    return a != nil && len(a.Poc.Rules) > 0
}

Try / catch

poc, err := adapter.ToFscanPoc()
if err != nil && strings.Contains(err.Error(), "webscan_afrog_no_rules") {
    log.Warnf("skipping POC %s: no rules", adapter.GetName())
    return nil
}

Prevention

When it happens

Trigger: Calling ToFscanPoc on an AfrogPocAdapter whose underlying AfrogPoc has no convertible rule/payload entries — empty sets, unsupported expression syntax, or missing rule sections.

Common situations: Afrog POC templates from incompatible versions whose rule schema changed; POCs with only metadata and an expression the converter can't translate; programmatically built AfrogPoc without populating rules.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


AI-assisted analysis of shadow1ng/fscan@95cc12e753 (2026-09-06). Data as JSON: /api/errors/7f89c18441123191. Report an issue: GitHub.