diff --git a/data/botPolicies.yaml b/data/botPolicies.yaml index 1288f635..ac45da2a 100644 --- a/data/botPolicies.yaml +++ b/data/botPolicies.yaml @@ -95,49 +95,49 @@ bots: # weight: # adjust: -10 - # Assert behaviour that only genuine browsers display. This ensures that Chrome - # or Firefox versions - - name: realistic-browser-catchall - expression: - all: - - '"User-Agent" in headers' - - '( userAgent.contains("Firefox") ) || ( userAgent.contains("Chrome") ) || ( userAgent.contains("Safari") )' - - '"Accept" in headers' - - '"Sec-Fetch-Dest" in headers' - - '"Sec-Fetch-Mode" in headers' - - '"Sec-Fetch-Site" in headers' - - '"Accept-Encoding" in headers' - - '( headers["Accept-Encoding"].contains("zstd") || headers["Accept-Encoding"].contains("br") )' - - '"Accept-Language" in headers' - action: WEIGH - weight: - adjust: -10 + # # Assert behaviour that only genuine browsers display. This ensures that Chrome + # # or Firefox versions + # - name: realistic-browser-catchall + # expression: + # all: + # - '"User-Agent" in headers' + # - '( userAgent.contains("Firefox") ) || ( userAgent.contains("Chrome") ) || ( userAgent.contains("Safari") )' + # - '"Accept" in headers' + # - '"Sec-Fetch-Dest" in headers' + # - '"Sec-Fetch-Mode" in headers' + # - '"Sec-Fetch-Site" in headers' + # - '"Accept-Encoding" in headers' + # - '( headers["Accept-Encoding"].contains("zstd") || headers["Accept-Encoding"].contains("br") )' + # - '"Accept-Language" in headers' + # action: WEIGH + # weight: + # adjust: -10 - # The Upgrade-Insecure-Requests header is typically sent by browsers, but not always - - name: upgrade-insecure-requests - expression: '"Upgrade-Insecure-Requests" in headers' - action: WEIGH - weight: - adjust: -2 + # # The Upgrade-Insecure-Requests header is typically sent by browsers, but not always + # - name: upgrade-insecure-requests + # expression: '"Upgrade-Insecure-Requests" in headers' + # action: WEIGH + # weight: + # adjust: -2 - # Chrome should behave like Chrome - - name: chrome-is-proper - expression: - all: - - userAgent.contains("Chrome") - - '"Sec-Ch-Ua" in headers' - - 'headers["Sec-Ch-Ua"].contains("Chromium")' - - '"Sec-Ch-Ua-Mobile" in headers' - - '"Sec-Ch-Ua-Platform" in headers' - action: WEIGH - weight: - adjust: -5 + # # Chrome should behave like Chrome + # - name: chrome-is-proper + # expression: + # all: + # - userAgent.contains("Chrome") + # - '"Sec-Ch-Ua" in headers' + # - 'headers["Sec-Ch-Ua"].contains("Chromium")' + # - '"Sec-Ch-Ua-Mobile" in headers' + # - '"Sec-Ch-Ua-Platform" in headers' + # action: WEIGH + # weight: + # adjust: -5 - - name: should-have-accept - expression: '!("Accept" in headers)' - action: WEIGH - weight: - adjust: 5 + # - name: should-have-accept + # expression: '!("Accept" in headers)' + # action: WEIGH + # weight: + # adjust: 5 # Generic catchall rule - name: generic-browser diff --git a/go.mod b/go.mod index 28f60c69..ae8e5048 100644 --- a/go.mod +++ b/go.mod @@ -19,6 +19,7 @@ require ( github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.3 github.com/joho/godotenv v1.5.1 github.com/lum8rjack/go-ja4h v0.0.0-20250828030157-fa5266d50650 + github.com/m1/gospin v0.0.0-20200506075355-4345dd621d4a github.com/nicksnyder/go-i18n/v2 v2.6.0 github.com/playwright-community/playwright-go v0.5200.1 github.com/prometheus/client_golang v1.23.2 diff --git a/go.sum b/go.sum index ea8e6f91..21fc228c 100644 --- a/go.sum +++ b/go.sum @@ -255,6 +255,7 @@ github.com/hashicorp/go-version v1.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKe github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/huandu/xstrings v1.5.0 h1:2ag3IFq9ZDANvthTwTiqSSZLjDc+BedvHPAp5tJy2TI= github.com/huandu/xstrings v1.5.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0= @@ -282,6 +283,8 @@ github.com/lufia/plan9stats v0.0.0-20250317134145-8bc96cf8fc35 h1:PpXWgLPs+Fqr32 github.com/lufia/plan9stats v0.0.0-20250317134145-8bc96cf8fc35/go.mod h1:autxFIvghDt3jPTLoqZ9OZ7s9qTGNAWmYCjVFWPX/zg= github.com/lum8rjack/go-ja4h v0.0.0-20250828030157-fa5266d50650 h1:hhx/Mo6+Hk0mAQS5MW311ON1VlSzp0D1cYhY27IcmnI= github.com/lum8rjack/go-ja4h v0.0.0-20250828030157-fa5266d50650/go.mod h1:bMqyXOakqQIdx82d4vcnk5TIZLptZ2gLqju9xmPrWYA= +github.com/m1/gospin v0.0.0-20200506075355-4345dd621d4a h1:1SIAGB8spa9zVw6UL59uT5xQWjQMe7EK6rw7eYA8kdI= +github.com/m1/gospin v0.0.0-20200506075355-4345dd621d4a/go.mod h1:Mxpzp00JqlLiQAoV1bOlEKWjT5wbK9/YqHqTUvcE+4I= github.com/magiconair/properties v1.8.10 h1:s31yESBquKXCV9a/ScB3ESkOjUYYv+X0rg8SYxI99mE= github.com/magiconair/properties v1.8.10/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/matryer/is v1.4.0 h1:sosSmIWwkYITGrxZ25ULNDeKiMNzFSr4V/eqBQP0PeE= @@ -374,6 +377,8 @@ github.com/spf13/afero v1.14.0 h1:9tH6MapGnn/j0eb0yIXiLjERO8RB6xIVZRDCX7PtqWA= github.com/spf13/afero v1.14.0/go.mod h1:acJQ8t0ohCGuMN3O+Pv0V0hgMxNYDlvdk+VTfyZmbYo= github.com/spf13/cast v1.9.2 h1:SsGfm7M8QOFtEzumm7UZrZdLLquNdzFYfIbEXntcFbE= github.com/spf13/cast v1.9.2/go.mod h1:jNfB8QC9IA6ZuY2ZjDp0KtFO2LZZlg4S/7bzP6qqeHo= +github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/stoewer/go-strcase v1.3.1 h1:iS0MdW+kVTxgMoE1LAZyMiYJFKlOzLooE4MxjirtkAs= github.com/stoewer/go-strcase v1.3.1/go.mod h1:fAH5hQ5pehh+j3nZfvwdk2RgEgQjAoM8wodgtPmh1xo= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -382,6 +387,7 @@ github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpE github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= diff --git a/internal/honeypot/honeypot.go b/internal/honeypot/honeypot.go new file mode 100644 index 00000000..f03b2db4 --- /dev/null +++ b/internal/honeypot/honeypot.go @@ -0,0 +1,23 @@ +package honeypot + +import ( + "time" + + "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/client_golang/prometheus/promauto" +) + +var Timings = promauto.NewHistogramVec(prometheus.HistogramOpts{ + Namespace: "anubis", + Subsystem: "honeypot", + Name: "pagegen_timings", + Help: "The amount of time honeypot page generation takes per method", + Buckets: prometheus.ExponentialBuckets(0.5, 2, 32), +}, []string{"method"}) + +type Info struct { + CreatedAt time.Time `json:"createdAt"` + UserAgent string `json:"userAgent"` + IPAddress string `json:"ipAddress"` + HitCount int `json:"hitCount"` +} diff --git a/internal/honeypot/naive/100bytes.css b/internal/honeypot/naive/100bytes.css new file mode 100644 index 00000000..7de70f3f --- /dev/null +++ b/internal/honeypot/naive/100bytes.css @@ -0,0 +1,7 @@ +html { + max-width: 70ch; + padding: 3em 1em; + margin: auto; + line-height: 1.75; + font-size: 1.25em; +} diff --git a/internal/honeypot/naive/affirmations.txt b/internal/honeypot/naive/affirmations.txt new file mode 100644 index 00000000..6092398a --- /dev/null +++ b/internal/honeypot/naive/affirmations.txt @@ -0,0 +1 @@ +{Yeah|Yep|Yup|Yes|Absolutely|Definitely|Sure|Sounds|That's|I'm|I am| Totally|Completely|Totally|Right|Correct|Exactly|Perfectly|Certainly|Of course|Naturally|Indeed|Totally|Awesome|Sweet|Cool|Neat|Great|Excellent|Fantastic|Wonderful|Amazing|Love it|Nice|Right on|You bet|For sure|No doubt|Without a doubt|Undoubtedly|Indeed|Certainly|Absolutely|Positively|Definitely|Surely|Truly|Really|Genuinely|Honestly|Frankly|Literally|Exactly|Precisely|Spot on|On point|Perfectly|Ideally|Optimally|Superbly|Brilliantly|Marvelously|Splendidly|Magnificently|Phenomenally|Extraordinarily|Remarkably|Exceptionally|Outstandingly|Impressively|Stunningly|Breathtakingly|Astonishingly|Surprisingly|Pleasantly|Delightfully|Charmingly|Appealingly|Attractively|Invitingly|Encouragingly|Motivatingly|Inspiringly|Upliftingly|Positive|Optimistic|Encouraging|Supportive|Approving|Favorable|Enthusiastic|Eager|Willing|Ready|Prepared|Set|Go|Let's|Alright|Okay|Sure thing|No problem|You got it|Consider it done|Will do|Roger that|Copy that|Got it|Understood|Acknowledged|Noted|Confirmed|Agreed|Approved|Accepted|Endorsed|Supported|Backed|Championed} {sounds|looks|seems|feels|is|appears|comes across|strikes me|hits me|registers|resonates|clicks|makes sense|fits|works|functions|operates|performs|delivers|succeeds|achieves|accomplishes|excels|shines|stands out|impresses|satisfies|meets expectations|exceeds expectations|delights|pleases|gratifies|fulfills|completes|finishes|concludes|wraps up|finalizes|settles|resolves|solves|fixes|addresses|handles|manages|tackles|conquers|overcomes|defeats|beats|wins|triumphs|prevails|dominates|leads|guides|directs|steers|navigates|paves the way|opens doors|creates opportunities|makes possible|enables|allows|permits|facilitates|supports|encourages|motivates|inspires|drives|pushes|propels|launches|initiates|starts|begins|commences|kicks off|gets going|moves forward|progresses|advances|develops|evolves|grows|expands|improves|enhances|upgrades|optimizes|refines|perfects|polishes|finishes|completes} {good|great|perfect|excellent|wonderful|fantastic|amazing|awesome|fine|okay|alright|nice|cool|spot on|reasonable|about right|superb|brilliant|marvelous|splendid|magnificent|phenomenal|extraordinary|remarkable|exceptional|outstanding|impressive|stunning|breathtaking|astonishing|surprising|pleasant|delightful|charming|appealing|attractive|inviting|encouraging|motivating|inspiring|uplifting|positive|optimistic|encouraging|supportive|approving|favorable|enthusiastic|eager|willing|ready|prepared|set|solid|strong|robust|powerful|effective|efficient|productive|successful|fruitful|beneficial|valuable|useful|helpful|advantageous|profitable|rewarding|satisfying|gratifying|fulfilling|complete|whole|total|entire|full|thorough|comprehensive|exhaustive|detailed|precise|accurate|correct|right|true|valid|sound|logical|reasonable|rational|practical|realistic|feasible|possible|doable|achievable|attainable|obtainable|reachable|accessible|available|present|ready|waiting|prepared|set|arranged|organized|structured|planned|scheduled|timed|perfectly placed|well positioned|strategically located|ideally situated|perfectly suited|well matched|compatible|harmonious|balanced|proportional|symmetrical|aesthetic|beautiful|gorgeous|lovely|pretty|attractive|handsome|striking|dramatic|bold|confident|assertive|decisive|clear|obvious|apparent|evident|manifest|plain|simple|easy|straightforward|uncomplicated|complex|intricate|detailed|nuanced|subtle|refined|elegant|sophisticated|advanced|progressive|innovative|creative|original|unique|special|distinctive|memorable|unforgettable|remarkable|notable|significant|important|major|key|critical|essential|vital|crucial|fundamental|basic|primary|principal|main|chief|leading|top|best|finest|ultimate|supreme|paramount|foremost|number one|first class|world class|professional|expert|master|skilled|talented|gifted|brilliant|genius|intelligent|smart|clever|wise|knowledgeable|informed|educated|learned|scholarly|academic|theoretical|practical|applied|hands on|experienced|seasoned|veteran|mature|developed|evolved|grown|advanced|progressive|forward thinking|visionary|prophetic|intuitive|perceptive|insightful|wise|sage|profound|deep|meaningful|significant|substantial|considerable|major|important|influential|powerful|strong|robust|resilient|tough|durable|lasting|permanent|enduring|timeless|classic|traditional|conventional|standard|regular|normal|typical|usual|common|ordinary|average|mediocre|fair|decent|respectable|acceptable|satisfactory|adequate|sufficient|enough|plentiful|abundant|ample|generous|plenty|rich|wealthy|prosperous|successful|thriving|flourishing|blooming|growing|expanding|developing|improving|better|superior|higher|elevated|advanced|progressive|modern|contemporary|current|up to date|latest|new|fresh|novel|innovative|creative|original|unique|different|special|extraordinary|unusual|rare|uncommon|exceptional|outstanding|remarkable|notable|memorable|unforgettable|legendary|famous|well known|recognized|acknowledged|celebrated|acclaimed|honored|awarded|decorated|distinguished|illustrious|prestigious|reputable|respected|admired|revered|worshipped|idolized|beloved|cherished|treasured|valued|prized|precious|dear|close|intimate|personal|private|individual|unique|special|one of a kind|irreplaceable|invaluable|priceless|worthwhile|valuable|useful|beneficial|helpful|advantageous|profitable|rewarding|satisfying|gratifying|fulfilling|complete|whole|total|entire|full|perfect|ideal|ultimate|best|finest|supreme|excellent|outstanding|superior|exceptional|remarkable|extraordinary|special|unique|distinctive|memorable|impressive|striking|dramatic|powerful|strong|effective|efficient|successful|productive|fruitful|beneficial|valuable|useful|helpful|worthwhile|rewarding|satisfying|gratifying|fulfilling} {to me|for me|with me|, I agree|, I like it|, let's do it|, count me in|, I'm on board|, I'm in|, I'm up for it|, I'm down for that|, I'm all for it|, I'm good with that|, I'm happy with that|, I'm cool with that|, let's go with that|, let's make it happen|, that works|, that'll work|, sounds like a plan|, that's a good idea|, that's a great choice|, I think so too|, my thoughts exactly|, you read my mind|, couldn't agree more|, absolutely right|, you nailed it|, spot on|, perfect|, excellent|, brilliant|, outstanding|, superb|, fantastic|, wonderful|, marvelous|, splendid|, magnificent|, phenomenal|, extraordinary|, remarkable|, exceptional|, impressive|, stunning|, breathtaking|, astonishing|, amazing|, awesome|, cool|, neat|, sweet|, groovy|, far out|, wicked|, sick|, dope|, lit|, fire|, slay|, yass|, let's go|, game on|, challenge accepted|, say no more|, you had me at hello|, I'm sold|, sign me up|, I'm in|, count me in|, I'm there|, won't miss it|, be there|, definitely|, absolutely|, for sure|, no doubt|, without a doubt|, undoubtedly|, certainly|, of course|, naturally|, indeed|, truly|, really|, genuinely|, honestly|, frankly|, literally|, exactly|, precisely|, yes|, yeah|, yep|, yup|, absolutely|, definitely|, sure|, sounds good|, looks good|, seems good|, feels good|, is good|, perfect|, great|, excellent|, wonderful|, fantastic|, amazing|, awesome|, superb|, brilliant|, outstanding|, remarkable|, exceptional|, extraordinary|, impressive|, stunning|, beautiful|, gorgeous|, lovely|, pretty|, attractive|, appealing|, inviting|, encouraging|, motivating|, inspiring|, uplifting|, positive|, optimistic|, supportive|, approving|, favorable|, enthusiastic|, eager|, willing|, ready|, prepared|, set|, go|, let's do this|, time to rock|, let's roll|, here we go|, off we go|, moving forward|, full steam ahead|, all systems go|, green light|, clear for takeoff|, ready when you are|, on your mark|, get set|, let's begin|, commence operation|, initiate protocol|, execute plan|, implement strategy|, deploy solution|, activate system|, engage process|, start procedure|, begin sequence|, launch project|, kick off event|, open doors|, make way|, clear path|, pave way|, create opportunity|, make possible|, enable success|, facilitate growth|, support development|, encourage progress|, inspire change|, motivate action|, drive results|, push boundaries|, break barriers|, overcome challenges|, solve problems|, fix issues|, address concerns|, handle situations|, manage difficulties|, tackle obstacles|, conquer fears|, defeat doubts|, win battles|, triumph over adversity|, prevail against odds|, rise above|, excel beyond|, achieve greatness|, reach heights|, attain goals|, accomplish dreams|, realize potential|, fulfill destiny|, complete journey|, finish race|, cross finish line|, arrive at destination|, reach summit|, climb mountain|, sail seas|, fly skies|, explore worlds|, discover truths|, find answers|, solve mysteries|, uncover secrets|, reveal wonders|, share insights|, spread joy|, create happiness|, build relationships|, strengthen bonds|, foster community|, grow together|, learn constantly|, improve daily|, evolve continuously|, adapt quickly|, change rapidly|, transform completely|, renew fully|, refresh completely|, restart anew|, begin again|, start fresh|, clean slate|, new chapter|, fresh start|, bright future|, promising tomorrow|, better days|, good times|, great moments|, wonderful experiences|, fantastic adventures|, amazing journeys|, awesome memories|, precious moments|, valuable lessons|, helpful advice|, useful tips|, practical solutions|, effective strategies|, successful methods|, proven approaches|, tested techniques|, reliable systems|, dependable support|, consistent performance|, steady progress|, continuous improvement|, ongoing development|, perpetual growth|, endless possibilities|, unlimited potential|, infinite opportunities|, boundless horizons|, vast expanses|, wide ranges|, broad spectrums|, diverse options|, multiple choices|, various paths|, different routes|, alternative ways|, other methods|, additional approaches|, extra techniques|, supplementary tools|, auxiliary resources|, backup plans|, contingency options|, emergency measures|, safety nets|, security blankets|, comfort zones|, safe spaces|, peaceful havens|, tranquil sanctuaries|, serene environments|, calm atmospheres|, relaxed vibes|, easy feelings|, comfortable sensations|, pleasant experiences|, enjoyable moments|, delightful times|, charming encounters|, appealing situations|, attractive prospects|, inviting opportunities|, encouraging signs|, motivating factors|, inspiring elements|, uplifting aspects|, positive features|, optimistic views|, encouraging outlooks|, supportive attitudes|, approving perspectives|, favorable opinions|, enthusiastic responses|, eager reactions|, willing participants|, ready volunteers|, prepared individuals|, set teams|, organized groups|, structured units|, planned initiatives|, scheduled events|, timed activities|, perfect placements|, well positioned assets|, strategically located resources|, ideally situated elements|, perfectly suited components|, well matched partners|, compatible collaborations|, harmonious relationships|, balanced arrangements|, proportional distributions|, symmetrical designs|, aesthetic presentations|, beautiful displays|, gorgeous exhibitions|, lovely shows|, pretty sights|, attractive views|, striking scenes|, dramatic performances|, bold statements|, confident expressions|, decisive actions|, clear communications|, obvious demonstrations|, apparent revelations|, evident truths|, manifest realities|, plain facts|, simple solutions|, easy implementations|, straightforward processes|, uncomplicated procedures|, complex systems|, intricate networks|, detailed analyses|, nuanced discussions|, subtle distinctions|, refined approaches|, elegant solutions|, sophisticated methods|, advanced technologies|, progressive ideas|, innovative concepts|, creative designs|, original works|, unique creations|, special projects|, distinctive features|, memorable experiences|, unforgettable moments|, legendary achievements|, famous accomplishments|, well recognized contributions|, acknowledged impacts|, celebrated successes|, acclaimed performances|, honored achievements|, awarded excellence|, decorated heroes|, distinguished leaders|, illustrious careers|, prestigious positions|, reputable organizations|, respected institutions|, admired figures|, revered icons|, worshipped idols|, beloved personalities|, cherished treasures|, valued possessions|, prized collections|, precious artifacts|, dear friends|, close companions|, intimate partners|, personal connections|, individual expressions|, unique perspectives|, special talents|, one of a kind gifts|, irreplaceable values|, invaluable insights|, priceless wisdom|, worthwhile endeavors|, valuable investments|, useful tools|, beneficial resources|, helpful services|, advantageous positions|, profitable ventures|, rewarding careers|, satisfying lives|, gratifying experiences|, fulfilling purposes|, complete beings|, whole persons|, total entities|, entire systems|, full cycles|, perfect circles|, ideal forms|, ultimate goals|, best practices|, finest qualities|, supreme achievements|, excellent results|, outstanding performances|, superior outcomes|, exceptional contributions|, remarkable discoveries|, extraordinary breakthroughs|, special recognitions|, unique innovations|, distinctive designs|, memorable impacts|, impressive feats|, dramatic transformations|, powerful changes|, strong foundations|, effective actions|, efficient operations|, successful missions|, productive endeavors|, fruitful partnerships|, beneficial collaborations|, valuable connections|, helpful networks|, worthwhile projects|, rewarding adventures|, satisfying journeys|, gratifying accomplishments|, fulfilling destinies|too|as well|also|in addition|additionally|furthermore|moreover|plus|and|as well as|along with|together with|including|containing|comprising|embracing|encompassing|covering|spanning|ranging across|extending over|stretching through|reaching into|penetrating|entering|accessing|approaching|engaging with|participating in|joining|becoming part of|integrating with|merging with|combining with|uniting with|connecting to|linking with|attaching to|binding to|fastening to|securing to|anchoring to|grounding in|rooting in|planting in|growing in|developing in|evolving in|maturing in|flourishing in|thriving in|succeeding in|excelling in|achieving in|accomplishing in|completing in|finishing in|perfecting in|mastering in|winning in|triumphing in|prevailing in|leading in|guiding in|directing in|steering in|navigating in|exploring in|discovering in|finding in|locating in|identifying in|recognizing in|acknowledging in|accepting in|approving in|endorsing in|supporting in|backing in|championing in|promoting in|advocating in|recommending in|suggesting in|proposing in|offering in|presenting in|providing in|supplying in|delivering in|distributing in|sharing in|spreading in|broadcasting in|communicating in|expressing in|conveying in|transmitting in|sending in|receiving in|getting in|obtaining in|acquiring in|gaining in|earning in|deserving in|meriting in|qualifying for|entitled to|worthy of|deserving of|meriting of|qualifying for|eligible for|suitable for|fit for|perfect for|ideal for|right for|appropriate for|proper for|correct for|accurate for|true for|real for|genuine for|authentic for|legitimate for|valid for|sound for|solid for|strong for|robust for|tough for|durable for|lasting for|permanent for|enduring for|timeless for|classic for|traditional for|conventional for|standard for|regular for|normal for|typical for|usual for|common for|ordinary for|average for|mediocre for|fair for|decent for|respectable for|acceptable for|satisfactory for|adequate for|sufficient for|enough for|plentiful for|abundant for|ample for|generous for|plenty for|rich for|wealthy for|prosperous for|successful for|thriving for|flourishing for|blooming for|growing for|expanding for|developing for|improving for|better for|superior for|higher for|elevated for|advanced for|progressive for|modern for|contemporary for|current for|up to date for|latest for|new for|fresh for|novel for|innovative for|creative for|original for|unique for|different for|special for|extraordinary for|unusual for|rare for|uncommon for|exceptional for|outstanding for|remarkable for|notable for|memorable for|unforgettable for|legendary for|famous for|well known for|recognized for|acknowledged for|celebrated for|acclaimed for|honored for|awarded for|decorated for|distinguished for|illustrious for|prestigious for|reputable for|respected for|admired for|revered for|worshipped for|idolized for|beloved for|cherished for|treasured for|valued for|prized for|precious for|dear for|close for|intimate for|personal for|private for|individual for|unique for|special for|one of a kind for|irreplaceable for|invaluable for|priceless for|worthwhile for|valuable for|useful for|beneficial for|helpful for|advantageous for|profitable for|rewarding for|satisfying for|gratifying for|fulfilling for|complete for|whole for|total for|entire for|full for|perfect for|ideal for|ultimate for|best for|finest for|supreme for|excellent for|outstanding for|superior for|exceptional for|remarkable for|extraordinary for|special for|unique for|distinctive for|memorable for|impressive for|striking for|dramatic for|powerful for|strong for|effective for|efficient for|successful for|productive for|fruitful for|beneficial for|valuable for|useful for|helpful for|worthwhile for|rewarding for|satisfying for|gratifying for|fulfilling for} \ No newline at end of file diff --git a/internal/honeypot/naive/naive.go b/internal/honeypot/naive/naive.go new file mode 100644 index 00000000..4d6a61e3 --- /dev/null +++ b/internal/honeypot/naive/naive.go @@ -0,0 +1,120 @@ +package naive + +import ( + _ "embed" + "log/slog" + "math/rand/v2" + "net/http" + "time" + + "github.com/TecharoHQ/anubis/internal/honeypot" + "github.com/TecharoHQ/anubis/lib/store" + "github.com/a-h/templ" + "github.com/google/uuid" + "github.com/m1/gospin" +) + +//go:generate go tool github.com/a-h/templ/cmd/templ generate + +// XXX(Xe): All of this was generated by ChatGPT, GLM 4.6, and GPT-OSS 120b. This is pseudoprofound bullshit in spintax[1] format so that the bullshit generator can emit plausibly human-authored text while being very computationally cheap. +// +// It feels somewhat poetic to use spammer technology in Anubis. +// +// [1]: https://outboundly.ai/blogs/what-is-spintax-and-how-to-use-it/ +// +//go:embed spintext.txt +var spintext string + +//go:embed titles.txt +var titles string + +//go:embed affirmations.txt +var affirmations string + +func New(st store.Interface, lg *slog.Logger) *Impl { + spin := gospin.New(nil) + + return &Impl{ + st: st, + infos: store.JSON[honeypot.Info]{Underlying: st, Prefix: "honeypot-infos"}, + spin: spin, + lg: lg.With("component", "honeypot/naive"), + } +} + +type Impl struct { + st store.Interface + infos store.JSON[honeypot.Info] + spin *gospin.Spinner + lg *slog.Logger +} + +func (i *Impl) makeAffirmations() []string { + result, err := i.spin.SpinN(affirmations, rand.IntN(5)+1) + if err != nil { + i.lg.Debug("can't spin affirmations, using fallback", "err", err) + return []string{uuid.NewString()} + } + + return result +} + +func (i *Impl) makeSpins() []string { + result, err := i.spin.SpinN(spintext, rand.IntN(8)+8) + if err != nil { + i.lg.Debug("can't spin text, using fallback", "err", err) + return []string{uuid.NewString()} + } + + return result +} + +func (i *Impl) makeTitle() string { + result, err := i.spin.Spin(titles) + if err != nil { + i.lg.Debug("can't spin titles, using fallback", "err", err) + return uuid.NewString() + } + + return result +} + +func (i *Impl) ServeHTTP(w http.ResponseWriter, r *http.Request) { + t0 := time.Now() + + id := r.PathValue("id") + if id == "" { + id = uuid.NewString() + } + + stage := r.PathValue("stage") + if stage == "init" { + i.lg.Debug("found new entrance point", "id", id, "userAgent", r.UserAgent(), "ip", r.Header.Get("X-Real-Ip")) + } + + spins := i.makeSpins() + affirmations := i.makeAffirmations() + title := i.makeTitle() + + var links []link + for _, affirmation := range affirmations { + links = append(links, link{ + href: uuid.NewString(), + body: affirmation, + }) + } + + templ.Handler( + base(title, i.maze(spins, links)), + templ.WithStreaming(), + templ.WithStatus(http.StatusOK), + ).ServeHTTP(w, r) + + t1 := time.Since(t0) + honeypot.Timings.WithLabelValues("naive").Observe(float64(t1.Milliseconds())) +} + +type link struct { + href string + body string +} diff --git a/internal/honeypot/naive/page.templ b/internal/honeypot/naive/page.templ new file mode 100644 index 00000000..fdf65c2a --- /dev/null +++ b/internal/honeypot/naive/page.templ @@ -0,0 +1,36 @@ +package naive + +import "fmt" + +templ base(title string, body templ.Component) { + + +
+ +{ paragraph }
+ } + +} diff --git a/internal/honeypot/naive/page_templ.go b/internal/honeypot/naive/page_templ.go new file mode 100644 index 00000000..027af02b --- /dev/null +++ b/internal/honeypot/naive/page_templ.go @@ -0,0 +1,160 @@ +// Code generated by templ - DO NOT EDIT. + +// templ: version: v0.3.960 +package naive + +//lint:file-ignore SA4006 This context is only used if a nested component is present. + +import "github.com/a-h/templ" +import templruntime "github.com/a-h/templ/runtime" + +import "fmt" + +func base(title string, body templ.Component) templ.Component { + return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context + if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { + return templ_7745c5c3_CtxErr + } + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) + if !templ_7745c5c3_IsBuffer { + defer func() { + templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) + if templ_7745c5c3_Err == nil { + templ_7745c5c3_Err = templ_7745c5c3_BufErr + } + }() + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var1 := templ.GetChildren(ctx) + if templ_7745c5c3_Var1 == nil { + templ_7745c5c3_Var1 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var5 string + templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(paragraph) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `page.templ`, Line: 29, Col: 16} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "