class

Crowbar::Session

Inherits JSON::Serializable < Reference < Object

Persistent Session Manager for iterative fuzzing and evolutionary feedback. Stores baseline input, bandit weights, genetic corpus, and mutation histories across CLI invocations.

Constructors

load_or_create(id : String, baseline : Buffer, rule_name : String | Nil = nil, pattern_name : String | Nil = nil, selected_mutations : String | Nil = nil, seed : UInt64 | Nil = nil, dir : String = default_dir) : Session
Source
new(id : String, baseline : Buffer, rule_name : String | Nil = nil, pattern_name : String | Nil = nil, selected_mutations : String | Nil = nil, seed : UInt64 | Nil = nil)
Source
new(*, __pull_for_json_serializable pull : JSON::PullParser)
Source

Class methods

default_dir
Source
exists?(id : String, dir : String = default_dir) : Bool
Source
items_dir(id : String, dir : String = default_dir) : String
Source
list(dir : String = default_dir) : Array(String)
Source
load(id : String, dir : String = default_dir) : Session | Nil
Source
reset(id : String, dir : String = default_dir) : Bool
Source
session_path(id : String, dir : String = default_dir) : String
Source

Instance methods

active_rules
Source
active_rules=(active_rules : Array(String))
Source
add_mutator(name : String) : self
Source
add_rule(name : String) : self
Source
add_scope(name : String, selector_type : String, params : Hash(String, String) = Hash(String, String).new, weight : Float64 = 1.0) : self
Source
arms
Source
arms=(arms : Hash(String, ArmState))
Source
auto_detect_rule
Source
baseline
Source
baseline=(buf : Buffer)
Source
baseline_b64
Source
baseline_b64=(baseline_b64 : String)
Source
build_engine

Builds and re-hydrates an Engine instance with stored session state

Source
clear_rules
Source
clear_scopes
Source
clear_seen_hashes
Source
corpus_items
Source
corpus_items=(corpus_items : Array(CandidateState))
Source
created_at
Source
created_at=(created_at : Time)
Source
get_item(iter : Int32) : SessionItem | Nil

Retrieves a SessionItem by iteration number

Source
get_mutant(iter : Int32, dir : String = Session.default_dir) : Buffer | Nil

Retrieves the mutant buffer for an iteration (from disk cache or deterministic replay)

Source
history
Source
history=(history : Array(HistoryEntry))
Source
id=(id : String)
Source
input_encoding
Source
input_encoding=(input_encoding : String | Nil)
Source
item_retention
Source
item_retention=(item_retention : Int32)
Source
items
Source
items=(items : Array(SessionItem))
Source
items_dir(dir : String = Session.default_dir) : String
Source
iteration
Source
iteration=(iteration : Int32)
Source
last_mutant
Source
last_mutant=(buf : Buffer | Nil)
Source
last_mutant_b64
Source
last_mutant_b64=(last_mutant_b64 : String | Nil)
Source
last_mutators
Source
last_mutators=(last_mutators : Array(String))
Source
last_reward
Source
last_reward=(last_reward : Float64 | Nil)
Source
next_mutant(dir : String = Session.default_dir, unique : Bool | Nil = nil, seek : Int64 | Nil = nil, template_override : String | Nil = nil) : Buffer

Generates the next mutant, updates session iteration, syncs bandit & corpus, and saves state. Optionally accepts runtime overrides for uniqueness deduplication, PRNG seek, and output templating.

Source
output_encoding
Source
output_encoding=(output_encoding : String | Nil)
Source
pattern_name
Source
pattern_name=(pattern_name : String | Nil)
Source
remove_mutator(name : String) : self
Source
remove_rule(name : String) : self
Source
remove_scope(name : String) : self
Source
replay(iter : Int32) : Tuple(Buffer, Array(TransformationStep))

Deterministically replays and reconstructs an iteration from baseline

Source
reset_mutators
Source
reset_with(new_baseline : Buffer, rule_name : String | Nil = nil, pattern_name : String | Nil = nil, selected_mutations : String | Nil = nil, seed : UInt64 | Nil = nil)

Resets the session with a new baseline input, clearing corpus and iteration counter

Source
reward(value : Float64, dir : String) : Session

Applies feedback score (-1.0 to 1.0) with custom directory override

Source
reward(value : Float64, iteration : Int32 | Nil = nil, dir : String = Session.default_dir) : Session

Applies feedback score (-1.0 to 1.0) to a specific generated mutant (default: latest)

Source
rule_name
Source
rule_name=(rule_name : String | Nil)
Source
save(dir : String = Session.default_dir)

Serializes session to JSON file on disk

Source
scopes
Source
scopes=(scopes : Array(ScopeConfig))
Source
seed
Source
seed=(seed : UInt64)
Source
seek_offset
Source
seek_offset=(seek_offset : Int64)
Source
seen_hashes
Source
seen_hashes=(seen_hashes : Array(UInt64))
Source
selected_mutations
Source
selected_mutations=(selected_mutations : String | Nil)
Source
set_mutators(list : Array(String)) : self
Source
set_pattern(pat : String) : self
Source
set_seek(offset : Int64) : self
Source
set_template(spec : String | Nil) : self
Source
set_unique(enabled : Bool, capacity : Int32 = 10000) : self
Source
template
Source
template=(template : String | Nil)
Source
total_pulls
Source
total_pulls=(total_pulls : Int64)
Source
unique_enabled
Source
unique_enabled=(unique_enabled : Bool)
Source
uniqueness_capacity
Source
uniqueness_capacity=(uniqueness_capacity : Int32)
Source
updated_at
Source
updated_at=(updated_at : Time)
Source