├── .gitattributes ├── .github ├── FUNDING.yml ├── dependabot.yml └── workflows │ ├── auto-assign.yml │ ├── build.yml │ └── release-please.yml ├── .gitignore ├── .release-please-manifest.json ├── CHANGELOG.md ├── Directory.Packages.props ├── LICENSE ├── Phishy.sln ├── Phishy.sln.DotSettings ├── Phishy ├── Configs │ ├── AppConfig.cs │ ├── ConfigValidator.cs │ └── Properties.cs ├── FishingStateMachine.cs ├── Hooks │ ├── KeyboardHook.cs │ ├── MouseHook.cs │ └── WinEventHook.cs ├── Interfaces │ ├── IAudioDetector.cs │ ├── IFishingStateMachine.cs │ ├── IHook.cs │ ├── IInputSimulator.cs │ ├── ILogger.cs │ └── IWindowManager.cs ├── Phishy.csproj ├── Program.cs ├── Services │ ├── AudioDetector.cs │ ├── ConsoleLogger.cs │ ├── InputSimulator.cs │ └── WindowManager.cs └── Utils │ ├── AudioUtils.cs │ ├── FileUtils.cs │ ├── KeyboardUtils.cs │ ├── MouseUtils.cs │ ├── WindowUtils.cs │ └── YamlUtils.cs ├── README.md ├── images ├── .net-desktop.png ├── first-launch.png └── startup.png ├── release-please-config.json └── version.txt /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | custom: 2 | - "https://www.paypal.com/donate/?hosted_button_id=RTLKLGXA7FGWY" 3 | - "https://revolut.me/stdnullptr" 4 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | # Enable version updates for NuGet packages 4 | - package-ecosystem: "nuget" 5 | directory: "/" 6 | schedule: 7 | interval: "weekly" 8 | day: "monday" 9 | time: "04:00" 10 | open-pull-requests-limit: 5 11 | reviewers: 12 | - "stdNullPtr" 13 | labels: 14 | - "dependencies" 15 | - "nuget" 16 | commit-message: 17 | prefix: "chore" 18 | include: "scope" 19 | pull-request-branch-name: 20 | separator: "-" 21 | 22 | # Enable version updates for GitHub Actions 23 | - package-ecosystem: "github-actions" 24 | directory: "/" 25 | schedule: 26 | interval: "weekly" 27 | day: "monday" 28 | time: "04:00" 29 | open-pull-requests-limit: 5 30 | reviewers: 31 | - "stdNullPtr" 32 | labels: 33 | - "dependencies" 34 | - "github-actions" 35 | commit-message: 36 | prefix: "chore" 37 | include: "scope" -------------------------------------------------------------------------------- /.github/workflows/auto-assign.yml: -------------------------------------------------------------------------------- 1 | name: Auto-assign PRs 2 | 3 | on: 4 | pull_request: 5 | types: [opened] 6 | 7 | permissions: 8 | pull-requests: write 9 | 10 | jobs: 11 | auto-assign: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - name: Auto-assign PR to maintainer 15 | uses: actions/github-script@v7 16 | with: 17 | github-token: ${{ secrets.GITHUB_TOKEN }} 18 | script: | 19 | github.rest.issues.addAssignees({ 20 | owner: context.repo.owner, 21 | repo: context.repo.repo, 22 | issue_number: context.issue.number, 23 | assignees: ['stdNullPtr'] 24 | }); 25 | 26 | console.log('Auto-assigned PR #' + context.issue.number + ' to stdNullPtr'); -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Build and Test 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | pull_request: 8 | branches: 9 | - master 10 | 11 | permissions: 12 | contents: read 13 | 14 | jobs: 15 | build: 16 | runs-on: windows-latest 17 | strategy: 18 | matrix: 19 | runtime: [win-x64, win-x86] 20 | 21 | steps: 22 | - name: Checkout 23 | uses: actions/checkout@v4 24 | 25 | - name: Setup .NET 26 | uses: actions/setup-dotnet@v4 27 | with: 28 | dotnet-version: 9.0.x 29 | 30 | - name: Restore dependencies 31 | run: dotnet restore 32 | 33 | - name: Build 34 | run: dotnet build --no-restore --configuration Release 35 | 36 | - name: Test 37 | run: dotnet test --no-build --verbosity normal --configuration Release || echo "No tests found" 38 | 39 | - name: Publish 40 | run: | 41 | dotnet publish Phishy/Phishy.csproj ` 42 | -c Release ` 43 | -r ${{ matrix.runtime }} ` 44 | -p:PublishSingleFile=true ` 45 | -p:SelfContained=true ` 46 | -p:PublishReadyToRun=true ` 47 | -p:DebugType=embedded ` 48 | -o artifacts/${{ matrix.runtime }} 49 | 50 | - name: Upload artifacts 51 | uses: actions/upload-artifact@v4 52 | with: 53 | name: phishy-${{ matrix.runtime }} 54 | path: artifacts/${{ matrix.runtime }} 55 | retention-days: 7 -------------------------------------------------------------------------------- /.github/workflows/release-please.yml: -------------------------------------------------------------------------------- 1 | name: Release Please 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | 8 | permissions: 9 | contents: write 10 | pull-requests: write 11 | 12 | jobs: 13 | release-please: 14 | runs-on: ubuntu-latest 15 | outputs: 16 | release_created: ${{ steps.release.outputs.release_created }} 17 | tag_name: ${{ steps.release.outputs.tag_name }} 18 | steps: 19 | - uses: googleapis/release-please-action@v4 20 | id: release 21 | with: 22 | config-file: release-please-config.json 23 | manifest-file: .release-please-manifest.json 24 | token: ${{ secrets.RELEASE_PLEASE_TOKEN || secrets.GITHUB_TOKEN }} 25 | 26 | build-and-release: 27 | needs: release-please 28 | if: ${{ needs.release-please.outputs.release_created }} 29 | runs-on: windows-latest 30 | strategy: 31 | matrix: 32 | include: 33 | - runtime: win-x64 34 | name: Windows-x64 35 | - runtime: win-x86 36 | name: Windows-x86 37 | 38 | steps: 39 | - name: Checkout 40 | uses: actions/checkout@v4 41 | 42 | - name: Setup .NET 43 | uses: actions/setup-dotnet@v4 44 | with: 45 | dotnet-version: 9.0.x 46 | 47 | - name: Restore dependencies 48 | run: dotnet restore 49 | 50 | - name: Build and Publish 51 | run: | 52 | dotnet publish Phishy/Phishy.csproj ` 53 | -c Release ` 54 | -r ${{ matrix.runtime }} ` 55 | -p:PublishSingleFile=true ` 56 | -p:SelfContained=true ` 57 | -p:PublishReadyToRun=true ` 58 | -p:DebugType=embedded ` 59 | -o publish/${{ matrix.runtime }} 60 | 61 | - name: Create ZIP archive 62 | run: | 63 | Compress-Archive -Path publish/${{ matrix.runtime }}/* -DestinationPath Phishy-${{ needs.release-please.outputs.tag_name }}-${{ matrix.name }}.zip 64 | 65 | - name: Upload Release Artifacts 66 | uses: softprops/action-gh-release@v2 67 | with: 68 | tag_name: ${{ needs.release-please.outputs.tag_name }} 69 | files: | 70 | Phishy-${{ needs.release-please.outputs.tag_name }}-${{ matrix.name }}.zip 71 | env: 72 | GITHUB_TOKEN: ${{ secrets.RELEASE_PLEASE_TOKEN || secrets.GITHUB_TOKEN }} -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Dd]ebug/ 21 | [Dd]ebugPublic/ 22 | [Rr]elease/ 23 | [Rr]eleases/ 24 | x64/ 25 | x86/ 26 | [Ww][Ii][Nn]32/ 27 | [Aa][Rr][Mm]/ 28 | [Aa][Rr][Mm]64/ 29 | bld/ 30 | [Bb]in/ 31 | [Oo]bj/ 32 | [Oo]ut/ 33 | [Ll]og/ 34 | [Ll]ogs/ 35 | 36 | # Visual Studio 2015/2017 cache/options directory 37 | .vs/ 38 | # Uncomment if you have tasks that create the project's static files in wwwroot 39 | #wwwroot/ 40 | 41 | # Visual Studio 2017 auto generated files 42 | Generated\ Files/ 43 | 44 | # MSTest test Results 45 | [Tt]est[Rr]esult*/ 46 | [Bb]uild[Ll]og.* 47 | 48 | # NUnit 49 | *.VisualState.xml 50 | TestResult.xml 51 | nunit-*.xml 52 | 53 | # Build Results of an ATL Project 54 | [Dd]ebugPS/ 55 | [Rr]eleasePS/ 56 | dlldata.c 57 | 58 | # Benchmark Results 59 | BenchmarkDotNet.Artifacts/ 60 | 61 | # .NET Core 62 | project.lock.json 63 | project.fragment.lock.json 64 | artifacts/ 65 | 66 | # ASP.NET Scaffolding 67 | ScaffoldingReadMe.txt 68 | 69 | # StyleCop 70 | StyleCopReport.xml 71 | 72 | # Files built by Visual Studio 73 | *_i.c 74 | *_p.c 75 | *_h.h 76 | *.ilk 77 | *.meta 78 | *.obj 79 | *.iobj 80 | *.pch 81 | *.pdb 82 | *.ipdb 83 | *.pgc 84 | *.pgd 85 | *.rsp 86 | *.sbr 87 | *.tlb 88 | *.tli 89 | *.tlh 90 | *.tmp 91 | *.tmp_proj 92 | *_wpftmp.csproj 93 | *.log 94 | *.vspscc 95 | *.vssscc 96 | .builds 97 | *.pidb 98 | *.svclog 99 | *.scc 100 | 101 | # Chutzpah Test files 102 | _Chutzpah* 103 | 104 | # Visual C++ cache files 105 | ipch/ 106 | *.aps 107 | *.ncb 108 | *.opendb 109 | *.opensdf 110 | *.sdf 111 | *.cachefile 112 | *.VC.db 113 | *.VC.VC.opendb 114 | 115 | # Visual Studio profiler 116 | *.psess 117 | *.vsp 118 | *.vspx 119 | *.sap 120 | 121 | # Visual Studio Trace Files 122 | *.e2e 123 | 124 | # TFS 2012 Local Workspace 125 | $tf/ 126 | 127 | # Guidance Automation Toolkit 128 | *.gpState 129 | 130 | # ReSharper is a .NET coding add-in 131 | _ReSharper*/ 132 | *.[Rr]e[Ss]harper 133 | *.DotSettings.user 134 | 135 | # TeamCity is a build add-in 136 | _TeamCity* 137 | 138 | # DotCover is a Code Coverage Tool 139 | *.dotCover 140 | 141 | # AxoCover is a Code Coverage Tool 142 | .axoCover/* 143 | !.axoCover/settings.json 144 | 145 | # Coverlet is a free, cross platform Code Coverage Tool 146 | coverage*.json 147 | coverage*.xml 148 | coverage*.info 149 | 150 | # Visual Studio code coverage results 151 | *.coverage 152 | *.coveragexml 153 | 154 | # NCrunch 155 | _NCrunch_* 156 | .*crunch*.local.xml 157 | nCrunchTemp_* 158 | 159 | # MightyMoose 160 | *.mm.* 161 | AutoTest.Net/ 162 | 163 | # Web workbench (sass) 164 | .sass-cache/ 165 | 166 | # Installshield output folder 167 | [Ee]xpress/ 168 | 169 | # DocProject is a documentation generator add-in 170 | DocProject/buildhelp/ 171 | DocProject/Help/*.HxT 172 | DocProject/Help/*.HxC 173 | DocProject/Help/*.hhc 174 | DocProject/Help/*.hhk 175 | DocProject/Help/*.hhp 176 | DocProject/Help/Html2 177 | DocProject/Help/html 178 | 179 | # Click-Once directory 180 | publish/ 181 | 182 | # Publish Web Output 183 | *.[Pp]ublish.xml 184 | *.azurePubxml 185 | # Note: Comment the next line if you want to checkin your web deploy settings, 186 | # but database connection strings (with potential passwords) will be unencrypted 187 | *.pubxml 188 | *.publishproj 189 | 190 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 191 | # checkin your Azure Web App publish settings, but sensitive information contained 192 | # in these scripts will be unencrypted 193 | PublishScripts/ 194 | 195 | # NuGet Packages 196 | *.nupkg 197 | # NuGet Symbol Packages 198 | *.snupkg 199 | # The packages folder can be ignored because of Package Restore 200 | **/[Pp]ackages/* 201 | # except build/, which is used as an MSBuild target. 202 | !**/[Pp]ackages/build/ 203 | # Uncomment if necessary however generally it will be regenerated when needed 204 | #!**/[Pp]ackages/repositories.config 205 | # NuGet v3's project.json files produces more ignorable files 206 | *.nuget.props 207 | *.nuget.targets 208 | 209 | # Microsoft Azure Build Output 210 | csx/ 211 | *.build.csdef 212 | 213 | # Microsoft Azure Emulator 214 | ecf/ 215 | rcf/ 216 | 217 | # Windows Store app package directories and files 218 | AppPackages/ 219 | BundleArtifacts/ 220 | Package.StoreAssociation.xml 221 | _pkginfo.txt 222 | *.appx 223 | *.appxbundle 224 | *.appxupload 225 | 226 | # Visual Studio cache files 227 | # files ending in .cache can be ignored 228 | *.[Cc]ache 229 | # but keep track of directories ending in .cache 230 | !?*.[Cc]ache/ 231 | 232 | # Others 233 | ClientBin/ 234 | ~$* 235 | *~ 236 | *.dbmdl 237 | *.dbproj.schemaview 238 | *.jfm 239 | *.pfx 240 | *.publishsettings 241 | orleans.codegen.cs 242 | 243 | # Including strong name files can present a security risk 244 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 245 | #*.snk 246 | 247 | # Since there are multiple workflows, uncomment next line to ignore bower_components 248 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 249 | #bower_components/ 250 | 251 | # RIA/Silverlight projects 252 | Generated_Code/ 253 | 254 | # Backup & report files from converting an old project file 255 | # to a newer Visual Studio version. Backup files are not needed, 256 | # because we have git ;-) 257 | _UpgradeReport_Files/ 258 | Backup*/ 259 | UpgradeLog*.XML 260 | UpgradeLog*.htm 261 | ServiceFabricBackup/ 262 | *.rptproj.bak 263 | 264 | # SQL Server files 265 | *.mdf 266 | *.ldf 267 | *.ndf 268 | 269 | # Business Intelligence projects 270 | *.rdl.data 271 | *.bim.layout 272 | *.bim_*.settings 273 | *.rptproj.rsuser 274 | *- [Bb]ackup.rdl 275 | *- [Bb]ackup ([0-9]).rdl 276 | *- [Bb]ackup ([0-9][0-9]).rdl 277 | 278 | # Microsoft Fakes 279 | FakesAssemblies/ 280 | 281 | # GhostDoc plugin setting file 282 | *.GhostDoc.xml 283 | 284 | # Node.js Tools for Visual Studio 285 | .ntvs_analysis.dat 286 | node_modules/ 287 | 288 | # Visual Studio 6 build log 289 | *.plg 290 | 291 | # Visual Studio 6 workspace options file 292 | *.opt 293 | 294 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 295 | *.vbw 296 | 297 | # Visual Studio LightSwitch build output 298 | **/*.HTMLClient/GeneratedArtifacts 299 | **/*.DesktopClient/GeneratedArtifacts 300 | **/*.DesktopClient/ModelManifest.xml 301 | **/*.Server/GeneratedArtifacts 302 | **/*.Server/ModelManifest.xml 303 | _Pvt_Extensions 304 | 305 | # Paket dependency manager 306 | .paket/paket.exe 307 | paket-files/ 308 | 309 | # FAKE - F# Make 310 | .fake/ 311 | 312 | # CodeRush personal settings 313 | .cr/personal 314 | 315 | # Python Tools for Visual Studio (PTVS) 316 | __pycache__/ 317 | *.pyc 318 | 319 | # Cake - Uncomment if you are using it 320 | # tools/** 321 | # !tools/packages.config 322 | 323 | # Tabs Studio 324 | *.tss 325 | 326 | # Telerik's JustMock configuration file 327 | *.jmconfig 328 | 329 | # BizTalk build output 330 | *.btp.cs 331 | *.btm.cs 332 | *.odx.cs 333 | *.xsd.cs 334 | 335 | # OpenCover UI analysis results 336 | OpenCover/ 337 | 338 | # Azure Stream Analytics local run output 339 | ASALocalRun/ 340 | 341 | # MSBuild Binary and Structured Log 342 | *.binlog 343 | 344 | # NVidia Nsight GPU debugger configuration file 345 | *.nvuser 346 | 347 | # MFractors (Xamarin productivity tool) working folder 348 | .mfractor/ 349 | 350 | # Local History for Visual Studio 351 | .localhistory/ 352 | 353 | # BeatPulse healthcheck temp database 354 | healthchecksdb 355 | 356 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 357 | MigrationBackup/ 358 | 359 | # Ionide (cross platform F# VS Code tools) working folder 360 | .ionide/ 361 | 362 | # Fody - auto-generated XML schema 363 | FodyWeavers.xsd 364 | 365 | .idea -------------------------------------------------------------------------------- /.release-please-manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | ".": "1.1.0" 3 | } -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## [1.1.0](https://github.com/stdNullPtr/Phishy/compare/phishy-v1.0.0...phishy-v1.1.0) (2025-06-01) 4 | 5 | 6 | ### Features 7 | 8 | * add auto-assignment of PRs to maintainer ([#11](https://github.com/stdNullPtr/Phishy/issues/11)) ([e8255d3](https://github.com/stdNullPtr/Phishy/commit/e8255d3570cfdaa8642a3de88ea7477fa2dd8e5c)) 9 | * add interact key fishing mode support ([#12](https://github.com/stdNullPtr/Phishy/issues/12)) ([98ebc19](https://github.com/stdNullPtr/Phishy/commit/98ebc19d65066f84655db3d41cf8498408bf0f09)) 10 | 11 | 12 | ### Bug Fixes 13 | 14 | * correct license from MIT claim to actual AGPL-3.0 ([#9](https://github.com/stdNullPtr/Phishy/issues/9)) ([ee71dd5](https://github.com/stdNullPtr/Phishy/commit/ee71dd5c816a223547b9da6a774983a8c843f250)) 15 | 16 | ## 1.0.0 (2025-06-01) 17 | 18 | 19 | ### Features 20 | 21 | * add comprehensive GitHub Actions CI/CD pipeline ([5a714d7](https://github.com/stdNullPtr/Phishy/commit/5a714d7ffebeeaede91adb91378df6884843d868)) 22 | * add comprehensive GitHub Actions CI/CD pipeline ([1468cf8](https://github.com/stdNullPtr/Phishy/commit/1468cf8d8776b892121c56ea6c9594d1993c3390)) 23 | * Create FUNDING.yml ([3cfeca7](https://github.com/stdNullPtr/Phishy/commit/3cfeca7cd38c050f7df3240313339f338fcdf2ed)) 24 | * improve code quality and upgrade to .NET 9 ([d3c040c](https://github.com/stdNullPtr/Phishy/commit/d3c040c413fa1aa6bd7da9824b8da615265116e6)) 25 | 26 | 27 | ### Bug Fixes 28 | 29 | * resolve compilation errors in refactored code ([8ba0424](https://github.com/stdNullPtr/Phishy/commit/8ba0424d18b85250353df218a93174b0a812ddba)) 30 | * use PAT for release-please to enable label creation ([#7](https://github.com/stdNullPtr/Phishy/issues/7)) ([f64c9d4](https://github.com/stdNullPtr/Phishy/commit/f64c9d4c1325f1bb0d94677528471f85a15aee6a)) 31 | 32 | ## Changelog 33 | -------------------------------------------------------------------------------- /Directory.Packages.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | true 4 | true 5 | $(NoWarn);NU1507 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Phishy - Out-of-process fishing automation tool for World of Warcraft 2 | Copyright (C) 2024-2025 stdNullPtr 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Affero General Public License as published 6 | by the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | GNU AFFERO GENERAL PUBLIC LICENSE 10 | Version 3, 19 November 2007 11 | 12 | Copyright (C) 2007 Free Software Foundation, Inc. 13 | Everyone is permitted to copy and distribute verbatim copies 14 | of this license document, but changing it is not allowed. 15 | 16 | Preamble 17 | 18 | The GNU Affero General Public License is a free, copyleft license for 19 | software and other kinds of works, specifically designed to ensure 20 | cooperation with the community in the case of network server software. 21 | 22 | The licenses for most software and other practical works are designed 23 | to take away your freedom to share and change the works. By contrast, 24 | our General Public Licenses are intended to guarantee your freedom to 25 | share and change all versions of a program--to make sure it remains free 26 | software for all its users. 27 | 28 | When we speak of free software, we are referring to freedom, not 29 | price. Our General Public Licenses are designed to make sure that you 30 | have the freedom to distribute copies of free software (and charge for 31 | them if you wish), that you receive source code or can get it if you 32 | want it, that you can change the software or use pieces of it in new 33 | free programs, and that you know you can do these things. 34 | 35 | Developers that use our General Public Licenses protect your rights 36 | with two steps: (1) assert copyright on the software, and (2) offer 37 | you this License which gives you legal permission to copy, distribute 38 | and/or modify the software. 39 | 40 | A secondary benefit of defending all users' freedom is that 41 | improvements made in alternate versions of the program, if they 42 | receive widespread use, become available for other developers to 43 | incorporate. Many developers of free software are heartened and 44 | encouraged by the resulting cooperation. However, in the case of 45 | software used on network servers, this result may fail to come about. 46 | The GNU General Public License permits making a modified version and 47 | letting the public access it on a server without ever releasing its 48 | source code to the public. 49 | 50 | The GNU Affero General Public License is designed specifically to 51 | ensure that, in such cases, the modified source code becomes available 52 | to the community. It requires the operator of a network server to 53 | provide the source code of the modified version running there to the 54 | users of that server. Therefore, public use of a modified version, on 55 | a publicly accessible server, gives the public access to the source 56 | code of the modified version. 57 | 58 | An older license, called the Affero General Public License and 59 | published by Affero, was designed to accomplish similar goals. This is 60 | a different license, not a version of the Affero GPL, but Affero has 61 | released a new version of the Affero GPL which permits relicensing under 62 | this license. 63 | 64 | The precise terms and conditions for copying, distribution and 65 | modification follow. 66 | 67 | TERMS AND CONDITIONS 68 | 69 | 0. Definitions. 70 | 71 | "This License" refers to version 3 of the GNU Affero General Public License. 72 | 73 | "Copyright" also means copyright-like laws that apply to other kinds of 74 | works, such as semiconductor masks. 75 | 76 | "The Program" refers to any copyrightable work licensed under this 77 | License. Each licensee is addressed as "you". "Licensees" and 78 | "recipients" may be individuals or organizations. 79 | 80 | To "modify" a work means to copy from or adapt all or part of the work 81 | in a fashion requiring copyright permission, other than the making of an 82 | exact copy. The resulting work is called a "modified version" of the 83 | earlier work or a work "based on" the earlier work. 84 | 85 | A "covered work" means either the unmodified Program or a work based 86 | on the Program. 87 | 88 | To "propagate" a work means to do anything with it that, without 89 | permission, would make you directly or secondarily liable for 90 | infringement under applicable copyright law, except executing it on a 91 | computer or modifying a private copy. Propagation includes copying, 92 | distribution (with or without modification), making available to the 93 | public, and in some countries other activities as well. 94 | 95 | To "convey" a work means any kind of propagation that enables other 96 | parties to make or receive copies. Mere interaction with a user through 97 | a computer network, with no transfer of a copy, is not conveying. 98 | 99 | An interactive user interface displays "Appropriate Legal Notices" 100 | to the extent that it includes a convenient and prominently visible 101 | feature that (1) displays an appropriate copyright notice, and (2) 102 | tells the user that there is no warranty for the work (except to the 103 | extent that warranties are provided), that licensees may convey the 104 | work under this License, and how to view a copy of this License. If 105 | the interface presents a list of user commands or options, such as a 106 | menu, a prominent item in the list meets this criterion. 107 | 108 | 1. Source Code. 109 | 110 | The "source code" for a work means the preferred form of the work 111 | for making modifications to it. "Object code" means any non-source 112 | form of a work. 113 | 114 | A "Standard Interface" means an interface that either is an official 115 | standard defined by a recognized standards body, or, in the case of 116 | interfaces specified for a particular programming language, one that 117 | is widely used among developers working in that language. 118 | 119 | The "System Libraries" of an executable work include anything, other 120 | than the work as a whole, that (a) is included in the normal form of 121 | packaging a Major Component, but which is not part of that Major 122 | Component, and (b) serves only to enable use of the work with that 123 | Major Component, or to implement a Standard Interface for which an 124 | implementation is available to the public in source code form. A 125 | "Major Component", in this context, means a major essential component 126 | (kernel, window system, and so on) of the specific operating system 127 | (if any) on which the executable work runs, or a compiler used to 128 | produce the work, or an object code interpreter used to run it. 129 | 130 | The "Corresponding Source" for a work in object code form means all 131 | the source code needed to generate, install, and (for an executable 132 | work) run the object code and to modify the work, including scripts to 133 | control those activities. However, it does not include the work's 134 | System Libraries, or general-purpose tools or generally available free 135 | programs which are used unmodified in performing those activities but 136 | which are not part of the work. For example, Corresponding Source 137 | includes interface definition files associated with source files for 138 | the work, and the source code for shared libraries and dynamically 139 | linked subprograms that the work is specifically designed to require, 140 | such as by intimate data communication or control flow between those 141 | subprograms and other parts of the work. 142 | 143 | The Corresponding Source need not include anything that users 144 | can regenerate automatically from other parts of the Corresponding 145 | Source. 146 | 147 | The Corresponding Source for a work in source code form is that 148 | same work. 149 | 150 | 2. Basic Permissions. 151 | 152 | All rights granted under this License are granted for the term of 153 | copyright on the Program, and are irrevocable provided the stated 154 | conditions are met. This License explicitly affirms your unlimited 155 | permission to run the unmodified Program. The output from running a 156 | covered work is covered by this License only if the output, given its 157 | content, constitutes a covered work. This License acknowledges your 158 | rights of fair use or other equivalent, as provided by copyright law. 159 | 160 | You may make, run and propagate covered works that you do not 161 | convey, without conditions so long as your license otherwise remains 162 | in force. You may convey covered works to others for the sole purpose 163 | of having them make modifications exclusively for you, or provide you 164 | with facilities for running those works, provided that you comply with 165 | the terms of this License in conveying all material for which you do 166 | not control copyright. Those thus making or running the covered works 167 | for you must do so exclusively on your behalf, under your direction 168 | and control, on terms that prohibit them from making any copies of 169 | your copyrighted material outside their relationship with you. 170 | 171 | Conveying under any other circumstances is permitted solely under 172 | the conditions stated below. Sublicensing is not allowed; section 10 173 | makes it unnecessary. 174 | 175 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 176 | 177 | No covered work shall be deemed part of an effective technological 178 | measure under any applicable law fulfilling obligations under article 179 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 180 | similar laws prohibiting or restricting circumvention of such 181 | measures. 182 | 183 | When you convey a covered work, you waive any legal power to forbid 184 | circumvention of technological measures to the extent such circumvention 185 | is effected by exercising rights under this License with respect to 186 | the covered work, and you disclaim any intention to limit operation or 187 | modification of the work as a means of enforcing, against the work's 188 | users, your or third parties' legal rights to forbid circumvention of 189 | technological measures. 190 | 191 | 4. Conveying Verbatim Copies. 192 | 193 | You may convey verbatim copies of the Program's source code as you 194 | receive it, in any medium, provided that you conspicuously and 195 | appropriately publish on each copy an appropriate copyright notice; 196 | keep intact all notices stating that this License and any 197 | non-permissive terms added in accord with section 7 apply to the code; 198 | keep intact all notices of the absence of any warranty; and give all 199 | recipients a copy of this License along with the Program. 200 | 201 | You may charge any price or no price for each copy that you convey, 202 | and you may offer support or warranty protection for a fee. 203 | 204 | 5. Conveying Modified Source Versions. 205 | 206 | You may convey a work based on the Program, or the modifications to 207 | produce it from the Program, in the form of source code under the 208 | terms of section 4, provided that you also meet all of these conditions: 209 | 210 | a) The work must carry prominent notices stating that you modified 211 | it, and giving a relevant date. 212 | 213 | b) The work must carry prominent notices stating that it is 214 | released under this License and any conditions added under section 215 | 7. This requirement modifies the requirement in section 4 to 216 | "keep intact all notices". 217 | 218 | c) You must license the entire work, as a whole, under this 219 | License to anyone who comes into possession of a copy. This 220 | License will therefore apply, along with any applicable section 7 221 | additional terms, to the whole of the work, and all its parts, 222 | regardless of how they are packaged. This License gives no 223 | permission to license the work in any other way, but it does not 224 | invalidate such permission if you have separately received it. 225 | 226 | d) If the work has interactive user interfaces, each must display 227 | Appropriate Legal Notices; however, if the Program has interactive 228 | interfaces that do not display Appropriate Legal Notices, your 229 | work need not make them do so. 230 | 231 | A compilation of a covered work with other separate and independent 232 | works, which are not by their nature extensions of the covered work, 233 | and which are not combined with it such as to form a larger program, 234 | in or on a volume of a storage or distribution medium, is called an 235 | "aggregate" if the compilation and its resulting copyright are not 236 | used to limit the access or legal rights of the compilation's users 237 | beyond what the individual works permit. Inclusion of a covered work 238 | in an aggregate does not cause this License to apply to the other 239 | parts of the aggregate. 240 | 241 | 6. Conveying Non-Source Forms. 242 | 243 | You may convey a covered work in object code form under the terms 244 | of sections 4 and 5, provided that you also convey the 245 | machine-readable Corresponding Source under the terms of this License, 246 | in one of these ways: 247 | 248 | a) Convey the object code in, or embodied in, a physical product 249 | (including a physical distribution medium), accompanied by the 250 | Corresponding Source fixed on a durable physical medium 251 | customarily used for software interchange. 252 | 253 | b) Convey the object code in, or embodied in, a physical product 254 | (including a physical distribution medium), accompanied by a 255 | written offer, valid for at least three years and valid for as 256 | long as you offer spare parts or customer support for that product 257 | model, to give anyone who possesses the object code either (1) a 258 | copy of the Corresponding Source for all the software in the 259 | product that is covered by this License, on a durable physical 260 | medium customarily used for software interchange, for a price no 261 | more than your reasonable cost of physically performing this 262 | conveying of source, or (2) access to copy the 263 | Corresponding Source from a network server at no charge. 264 | 265 | c) Convey individual copies of the object code with a copy of the 266 | written offer to provide the Corresponding Source. This 267 | alternative is allowed only occasionally and noncommercially, and 268 | only if you received the object code with such an offer, in accord 269 | with subsection 6b. 270 | 271 | d) Convey the object code by offering access from a designated 272 | place (gratis or for a charge), and offer equivalent access to the 273 | Corresponding Source in the same way through the same place at no 274 | further charge. You need not require recipients to copy the 275 | Corresponding Source along with the object code. If the place to 276 | copy the object code is a network server, the Corresponding Source 277 | may be on a different server (operated by you or a third party) 278 | that supports equivalent copying facilities, provided you maintain 279 | clear directions next to the object code saying where to find the 280 | Corresponding Source. Regardless of what server hosts the 281 | Corresponding Source, you remain obligated to ensure that it is 282 | available for as long as needed to satisfy these requirements. 283 | 284 | e) Convey the object code using peer-to-peer transmission, provided 285 | you inform other peers where the object code and Corresponding 286 | Source of the work are being offered to the general public at no 287 | charge under subsection 6d. 288 | 289 | A separable portion of the object code, whose source code is excluded 290 | from the Corresponding Source as a System Library, need not be 291 | included in conveying the object code work. 292 | 293 | A "User Product" is either (1) a "consumer product", which means any 294 | tangible personal property which is normally used for personal, family, 295 | or household purposes, or (2) anything designed or sold for incorporation 296 | into a dwelling. In determining whether a product is a consumer product, 297 | doubtful cases shall be resolved in favor of coverage. For a particular 298 | product received by a particular user, "normally used" refers to a 299 | typical or common use of that class of product, regardless of the status 300 | of the particular user or of the way in which the particular user 301 | actually uses, or expects or is expected to use, the product. A product 302 | is a consumer product regardless of whether the product has substantial 303 | commercial, industrial or non-consumer uses, unless such uses represent 304 | the only significant mode of use of the product. 305 | 306 | "Installation Information" for a User Product means any methods, 307 | procedures, authorization keys, or other information required to install 308 | and execute modified versions of a covered work in that User Product from 309 | a modified version of its Corresponding Source. The information must 310 | suffice to ensure that the continued functioning of the modified object 311 | code is in no case prevented or interfered with solely because 312 | modification has been made. 313 | 314 | If you convey an object code work under this section in, or with, or 315 | specifically for use in, a User Product, and the conveying occurs as 316 | part of a transaction in which the right of possession and use of the 317 | User Product is transferred to the recipient in perpetuity or for a 318 | fixed term (regardless of how the transaction is characterized), the 319 | Corresponding Source conveyed under this section must be accompanied 320 | by the Installation Information. But this requirement does not apply 321 | if neither you nor any third party retains the ability to install 322 | modified object code on the User Product (for example, the work has 323 | been installed in ROM). 324 | 325 | The requirement to provide Installation Information does not include a 326 | requirement to continue to provide support service, warranty, or updates 327 | for a work that has been modified or installed by the recipient, or for 328 | the User Product in which it has been modified or installed. Access to a 329 | network may be denied when the modification itself materially and 330 | adversely affects the operation of the network or violates the rules and 331 | protocols for communication across the network. 332 | 333 | Corresponding Source conveyed, and Installation Information provided, 334 | in accord with this section must be in a format that is publicly 335 | documented (and with an implementation available to the public in 336 | source code form), and must require no special password or key for 337 | unpacking, reading or copying. 338 | 339 | 7. Additional Terms. 340 | 341 | "Additional permissions" are terms that supplement the terms of this 342 | License by making exceptions from one or more of its conditions. 343 | Additional permissions that are applicable to the entire Program shall 344 | be treated as though they were included in this License, to the extent 345 | that they are valid under applicable law. If additional permissions 346 | apply only to part of the Program, that part may be used separately 347 | under those permissions, but the entire Program remains governed by 348 | this License without regard to the additional permissions. 349 | 350 | When you convey a copy of a covered work, you may at your option 351 | remove any additional permissions from that copy, or from any part of 352 | it. (Additional permissions may be written to require their own 353 | removal in certain cases when you modify the work.) You may place 354 | additional permissions on material, added by you to a covered work, 355 | for which you have or can give appropriate copyright permission. 356 | 357 | Notwithstanding any other provision of this License, for material you 358 | add to a covered work, you may (if authorized by the copyright holders of 359 | that material) supplement the terms of this License with terms: 360 | 361 | a) Disclaiming warranty or limiting liability differently from the 362 | terms of sections 15 and 16 of this License; or 363 | 364 | b) Requiring preservation of specified reasonable legal notices or 365 | author attributions in that material or in the Appropriate Legal 366 | Notices displayed by works containing it; or 367 | 368 | c) Prohibiting misrepresentation of the origin of that material, or 369 | requiring that modified versions of such material be marked in 370 | reasonable ways as different from the original version; or 371 | 372 | d) Limiting the use for publicity purposes of names of licensors or 373 | authors of the material; or 374 | 375 | e) Declining to grant rights under trademark law for use of some 376 | trade names, trademarks, or service marks; or 377 | 378 | f) Requiring indemnification of licensors and authors of that 379 | material by anyone who conveys the material (or modified versions of 380 | it) with contractual assumptions of liability to the recipient, for 381 | any liability that these contractual assumptions directly impose on 382 | those licensors and authors. 383 | 384 | All other non-permissive additional terms are considered "further 385 | restrictions" within the meaning of section 10. If the Program as you 386 | received it, or any part of it, contains a notice stating that it is 387 | governed by this License along with a term that is a further 388 | restriction, you may remove that term. If a license document contains 389 | a further restriction but permits relicensing or conveying under this 390 | License, you may add to a covered work material governed by the terms 391 | of that license document, provided that the further restriction does 392 | not survive such relicensing or conveying. 393 | 394 | If you add terms to a covered work in accord with this section, you 395 | must place, in the relevant source files, a statement of the 396 | additional terms that apply to those files, or a notice indicating 397 | where to find the applicable terms. 398 | 399 | Additional terms, permissive or non-permissive, may be stated in the 400 | form of a separately written license, or stated as exceptions; 401 | the above requirements apply either way. 402 | 403 | 8. Termination. 404 | 405 | You may not propagate or modify a covered work except as expressly 406 | provided under this License. Any attempt otherwise to propagate or 407 | modify it is void, and will automatically terminate your rights under 408 | this License (including any patent licenses granted under the third 409 | paragraph of section 11). 410 | 411 | However, if you cease all violation of this License, then your 412 | license from a particular copyright holder is reinstated (a) 413 | provisionally, unless and until the copyright holder explicitly and 414 | finally terminates your license, and (b) permanently, if the copyright 415 | holder fails to notify you of the violation by some reasonable means 416 | prior to 60 days after the cessation. 417 | 418 | Moreover, your license from a particular copyright holder is 419 | reinstated permanently if the copyright holder notifies you of the 420 | violation by some reasonable means, this is the first time you have 421 | received notice of violation of this License (for any work) from that 422 | copyright holder, and you cure the violation prior to 30 days after 423 | your receipt of the notice. 424 | 425 | Termination of your rights under this section does not terminate the 426 | licenses of parties who have received copies or rights from you under 427 | this License. If your rights have been terminated and not permanently 428 | reinstated, you do not qualify to receive new licenses for the same 429 | material under section 10. 430 | 431 | 9. Acceptance Not Required for Having Copies. 432 | 433 | You are not required to accept this License in order to receive or 434 | run a copy of the Program. Ancillary propagation of a covered work 435 | occurring solely as a consequence of using peer-to-peer transmission 436 | to receive a copy likewise does not require acceptance. However, 437 | nothing other than this License grants you permission to propagate or 438 | modify any covered work. These actions infringe copyright if you do 439 | not accept this License. Therefore, by modifying or propagating a 440 | covered work, you indicate your acceptance of this License to do so. 441 | 442 | 10. Automatic Licensing of Downstream Recipients. 443 | 444 | Each time you convey a covered work, the recipient automatically 445 | receives a license from the original licensors, to run, modify and 446 | propagate that work, subject to this License. You are not responsible 447 | for enforcing compliance by third parties with this License. 448 | 449 | An "entity transaction" is a transaction transferring control of an 450 | organization, or substantially all assets of one, or subdividing an 451 | organization, or merging organizations. If propagation of a covered 452 | work results from an entity transaction, each party to that 453 | transaction who receives a copy of the work also receives whatever 454 | licenses to the work the party's predecessor in interest had or could 455 | give under the previous paragraph, plus a right to possession of the 456 | Corresponding Source of the work from the predecessor in interest, if 457 | the predecessor has it or can get it with reasonable efforts. 458 | 459 | You may not impose any further restrictions on the exercise of the 460 | rights granted or affirmed under this License. For example, you may 461 | not impose a license fee, royalty, or other charge for exercise of 462 | rights granted under this License, and you may not initiate litigation 463 | (including a cross-claim or counterclaim in a lawsuit) alleging that 464 | any patent claim is infringed by making, using, selling, offering for 465 | sale, or importing the Program or any portion of it. 466 | 467 | 11. Patents. 468 | 469 | A "contributor" is a copyright holder who authorizes use under this 470 | License of the Program or a work on which the Program is based. The 471 | work thus licensed is called the contributor's "contributor version". 472 | 473 | A contributor's "essential patent claims" are all patent claims 474 | owned or controlled by the contributor, whether already acquired or 475 | hereafter acquired, that would be infringed by some manner, permitted 476 | by this License, of making, using, or selling its contributor version, 477 | but do not include claims that would be infringed only as a 478 | consequence of further modification of the contributor version. For 479 | purposes of this definition, "control" includes the right to grant 480 | patent sublicenses in a manner consistent with the requirements of 481 | this License. 482 | 483 | Each contributor grants you a non-exclusive, worldwide, royalty-free 484 | patent license under the contributor's essential patent claims, to 485 | make, use, sell, offer for sale, import and otherwise run, modify and 486 | propagate the contents of its contributor version. 487 | 488 | In the following three paragraphs, a "patent license" is any express 489 | agreement or commitment, however denominated, not to enforce a patent 490 | (such as an express permission to practice a patent or covenant not to 491 | sue for patent infringement). To "grant" such a patent license to a 492 | party means to make such an agreement or commitment not to enforce a 493 | patent against the party. 494 | 495 | If you convey a covered work, knowingly relying on a patent license, 496 | and the Corresponding Source of the work is not available for anyone 497 | to copy, free of charge and under the terms of this License, through a 498 | publicly available network server or other readily accessible means, 499 | then you must either (1) cause the Corresponding Source to be so 500 | available, or (2) arrange to deprive yourself of the benefit of the 501 | patent license for this particular work, or (3) arrange, in a manner 502 | consistent with the requirements of this License, to extend the patent 503 | license to downstream recipients. "Knowingly relying" means you have 504 | actual knowledge that, but for the patent license, your conveying the 505 | covered work in a country, or your recipient's use of the covered work 506 | in a country, would infringe one or more identifiable patents in that 507 | country that you have reason to believe are valid. 508 | 509 | If, pursuant to or in connection with a single transaction or 510 | arrangement, you convey, or propagate by procuring conveyance of, a 511 | covered work, and grant a patent license to some of the parties 512 | receiving the covered work authorizing them to use, propagate, modify 513 | or convey a specific copy of the covered work, then the patent license 514 | you grant is automatically extended to all recipients of the covered 515 | work and works based on it. 516 | 517 | A patent license is "discriminatory" if it does not include within 518 | the scope of its coverage, prohibits the exercise of, or is 519 | conditioned on the non-exercise of one or more of the rights that are 520 | specifically granted under this License. You may not convey a covered 521 | work if you are a party to an arrangement with a third party that is 522 | in the business of distributing software, under which you make payment 523 | to the third party based on the extent of your activity of conveying 524 | the work, and under which the third party grants, to any of the 525 | parties who would receive the covered work from you, a discriminatory 526 | patent license (a) in connection with copies of the covered work 527 | conveyed by you (or copies made from those copies), or (b) primarily 528 | for and in connection with specific products or compilations that 529 | contain the covered work, unless you entered into that arrangement, 530 | or that patent license was granted, prior to 28 March 2007. 531 | 532 | Nothing in this License shall be construed as excluding or limiting 533 | any implied license or other defenses to infringement that may 534 | otherwise be available to you under applicable patent law. 535 | 536 | 12. No Surrender of Others' Freedom. 537 | 538 | If conditions are imposed on you (whether by court order, agreement or 539 | otherwise) that contradict the conditions of this License, they do not 540 | excuse you from the conditions of this License. If you cannot convey a 541 | covered work so as to satisfy simultaneously your obligations under this 542 | License and any other pertinent obligations, then as a consequence you may 543 | not convey it at all. For example, if you agree to terms that obligate you 544 | to collect a royalty for further conveying from those to whom you convey 545 | the Program, the only way you could satisfy both those terms and this 546 | License would be to refrain entirely from conveying the Program. 547 | 548 | 13. Remote Network Interaction; Use with the GNU General Public License. 549 | 550 | Notwithstanding any other provision of this License, if you modify the 551 | Program, your modified version must prominently offer all users 552 | interacting with it remotely through a computer network (if your version 553 | supports such interaction) an opportunity to receive the Corresponding 554 | Source of your version by providing access to the Corresponding Source 555 | from a network server at no charge, through some standard or customary 556 | means of facilitating copying of software. This Corresponding Source 557 | shall include the Corresponding Source for any work covered by version 3 558 | of the GNU General Public License that is incorporated pursuant to the 559 | following paragraph. 560 | 561 | Notwithstanding any other provision of this License, you have 562 | permission to link or combine any covered work with a work licensed 563 | under version 3 of the GNU General Public License into a single 564 | combined work, and to convey the resulting work. The terms of this 565 | License will continue to apply to the part which is the covered work, 566 | but the work with which it is combined will remain governed by version 567 | 3 of the GNU General Public License. 568 | 569 | 14. Revised Versions of this License. 570 | 571 | The Free Software Foundation may publish revised and/or new versions of 572 | the GNU Affero General Public License from time to time. Such new versions 573 | will be similar in spirit to the present version, but may differ in detail to 574 | address new problems or concerns. 575 | 576 | Each version is given a distinguishing version number. If the 577 | Program specifies that a certain numbered version of the GNU Affero General 578 | Public License "or any later version" applies to it, you have the 579 | option of following the terms and conditions either of that numbered 580 | version or of any later version published by the Free Software 581 | Foundation. If the Program does not specify a version number of the 582 | GNU Affero General Public License, you may choose any version ever published 583 | by the Free Software Foundation. 584 | 585 | If the Program specifies that a proxy can decide which future 586 | versions of the GNU Affero General Public License can be used, that proxy's 587 | public statement of acceptance of a version permanently authorizes you 588 | to choose that version for the Program. 589 | 590 | Later license versions may give you additional or different 591 | permissions. However, no additional obligations are imposed on any 592 | author or copyright holder as a result of your choosing to follow a 593 | later version. 594 | 595 | 15. Disclaimer of Warranty. 596 | 597 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 598 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 599 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 600 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 601 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 602 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 603 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 604 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 605 | 606 | 16. Limitation of Liability. 607 | 608 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 609 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 610 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 611 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 612 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 613 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 614 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 615 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 616 | SUCH DAMAGES. 617 | 618 | 17. Interpretation of Sections 15 and 16. 619 | 620 | If the disclaimer of warranty and limitation of liability provided 621 | above cannot be given local legal effect according to their terms, 622 | reviewing courts shall apply local law that most closely approximates 623 | an absolute waiver of all civil liability in connection with the 624 | Program, unless a warranty or assumption of liability accompanies a 625 | copy of the Program in return for a fee. 626 | 627 | END OF TERMS AND CONDITIONS 628 | 629 | How to Apply These Terms to Your New Programs 630 | 631 | If you develop a new program, and you want it to be of the greatest 632 | possible use to the public, the best way to achieve this is to make it 633 | free software which everyone can redistribute and change under these terms. 634 | 635 | To do so, attach the following notices to the program. It is safest 636 | to attach them to the start of each source file to most effectively 637 | state the exclusion of warranty; and each file should have at least 638 | the "copyright" line and a pointer to where the full notice is found. 639 | 640 | 641 | Copyright (C) 642 | 643 | This program is free software: you can redistribute it and/or modify 644 | it under the terms of the GNU Affero General Public License as published 645 | by the Free Software Foundation, either version 3 of the License, or 646 | (at your option) any later version. 647 | 648 | This program is distributed in the hope that it will be useful, 649 | but WITHOUT ANY WARRANTY; without even the implied warranty of 650 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 651 | GNU Affero General Public License for more details. 652 | 653 | You should have received a copy of the GNU Affero General Public License 654 | along with this program. If not, see . 655 | 656 | Also add information on how to contact you by electronic and paper mail. 657 | 658 | If your software can interact with users remotely through a computer 659 | network, you should also make sure that it provides a way for users to 660 | get its source. For example, if your program is a web application, its 661 | interface could display a "Source" link that leads users to an archive 662 | of the code. There are many ways you could offer source, and different 663 | solutions will be better for different programs; see section 13 for the 664 | specific requirements. 665 | 666 | You should also get your employer (if you work as a programmer) or school, 667 | if any, to sign a "copyright disclaimer" for the program, if necessary. 668 | For more information on this, and how to apply and follow the GNU AGPL, see 669 | . 670 | -------------------------------------------------------------------------------- /Phishy.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.5.33530.505 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Phishy", "Phishy\Phishy.csproj", "{3A592A19-24FE-46E7-9348-E6573E5BAEE3}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {3A592A19-24FE-46E7-9348-E6573E5BAEE3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {3A592A19-24FE-46E7-9348-E6573E5BAEE3}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {3A592A19-24FE-46E7-9348-E6573E5BAEE3}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {3A592A19-24FE-46E7-9348-E6573E5BAEE3}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {CD8D1E4D-98FD-4A2B-91CE-7D84291EB4CE} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /Phishy.sln.DotSettings: -------------------------------------------------------------------------------- 1 |  2 | True -------------------------------------------------------------------------------- /Phishy/Configs/AppConfig.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | using Phishy.Utils; 3 | 4 | namespace Phishy.Configs; 5 | 6 | public static class AppConfig 7 | { 8 | public const string CONFIGURATION_FILE_NAME = "configuration.yaml"; 9 | 10 | public static Properties Props { get; private set; } = new(); 11 | 12 | public static bool LoadProperties() 13 | { 14 | if (!FileUtils.FileExistsInCurrentDirectory(CONFIGURATION_FILE_NAME)) 15 | { 16 | Console.WriteLine("[AppConfig]: Configuration file is missing, a default one will be created and the application will exit!"); 17 | YamlUtils.GenerateSampleRunConfig(CONFIGURATION_FILE_NAME); 18 | Process.Start("notepad.exe", CONFIGURATION_FILE_NAME); 19 | return false; 20 | } 21 | 22 | Console.WriteLine($"[AppConfig]: Loading configuration from {CONFIGURATION_FILE_NAME}..."); 23 | Properties? props = YamlUtils.ReadPropertiesFromCurrentDirectory(CONFIGURATION_FILE_NAME); 24 | if (props is null) 25 | { 26 | Console.WriteLine($"[AppConfig]: Failed loading configuration from: '{CONFIGURATION_FILE_NAME}'!"); 27 | return false; 28 | } 29 | 30 | Props = props; 31 | 32 | // Validate configuration 33 | var validationResult = ConfigValidator.Validate(Props); 34 | if (!validationResult.IsValid) 35 | { 36 | Console.WriteLine(validationResult.ToString()); 37 | return false; 38 | } 39 | 40 | Console.WriteLine("[AppConfig]: Configuration validated successfully."); 41 | return true; 42 | } 43 | } -------------------------------------------------------------------------------- /Phishy/Configs/ConfigValidator.cs: -------------------------------------------------------------------------------- 1 | using System.Text; 2 | 3 | namespace Phishy.Configs; 4 | 5 | public class ConfigValidator 6 | { 7 | public static ValidationResult Validate(Properties properties) 8 | { 9 | var errors = new List(); 10 | 11 | if (string.IsNullOrWhiteSpace(properties.GameWindowName)) 12 | { 13 | errors.Add("GameWindowName is required"); 14 | } 15 | 16 | if (string.IsNullOrWhiteSpace(properties.KeyboardKeyStartFishing)) 17 | { 18 | errors.Add("KeyboardKeyStartFishing is required"); 19 | } 20 | if (properties.FishingChannelDurationSeconds < 1 || properties.FishingChannelDurationSeconds > 60) 21 | { 22 | errors.Add("FishingChannelDurationSeconds must be between 1 and 60 seconds"); 23 | } 24 | 25 | if (properties.LureBuffDurationMinutes < 0 || properties.LureBuffDurationMinutes > 60) 26 | { 27 | errors.Add("LureBuffDurationMinutes must be between 0 and 60 minutes"); 28 | } 29 | 30 | if (properties.SecondLureBuffDurationMinutes.HasValue) 31 | { 32 | if (properties.SecondLureBuffDurationMinutes.Value < 0 || properties.SecondLureBuffDurationMinutes.Value > 60) 33 | { 34 | errors.Add("SecondLureBuffDurationMinutes must be between 0 and 60 minutes"); 35 | } 36 | 37 | if (string.IsNullOrWhiteSpace(properties.KeyboardKeyApplySecondLure)) 38 | { 39 | errors.Add("KeyboardKeyApplySecondLure is required when SecondLureBuffDurationMinutes is set"); 40 | } 41 | } 42 | 43 | if (properties.WaitForWintergrasp) 44 | { 45 | if (string.IsNullOrWhiteSpace(properties.KeyboardPressLogout)) 46 | { 47 | errors.Add("KeyboardPressLogout is required when WaitForWintergrasp is enabled"); 48 | } 49 | } 50 | 51 | 52 | return new ValidationResult(errors); 53 | } 54 | } 55 | 56 | public class ValidationResult 57 | { 58 | public List Errors { get; } 59 | public bool IsValid => Errors.Count == 0; 60 | 61 | public ValidationResult(List errors) 62 | { 63 | Errors = errors ?? new List(); 64 | } 65 | 66 | public override string ToString() 67 | { 68 | if (IsValid) 69 | { 70 | return "Configuration is valid"; 71 | } 72 | 73 | var sb = new StringBuilder(); 74 | sb.AppendLine("Configuration validation failed:"); 75 | foreach (var error in Errors) 76 | { 77 | sb.AppendLine($" - {error}"); 78 | } 79 | return sb.ToString(); 80 | } 81 | } -------------------------------------------------------------------------------- /Phishy/Configs/Properties.cs: -------------------------------------------------------------------------------- 1 | using Phishy.Utils; 2 | using YamlDotNet.Serialization; 3 | 4 | namespace Phishy.Configs; 5 | 6 | public sealed class Properties 7 | { 8 | [YamlMember(Description = "Keyboard key binding for logout macro (Default: 3)")] 9 | public string KeyboardPressLogout { get; set; } 10 | 11 | [YamlMember(Description = "Whether or not to enable logout during Wintergrasp (Default: false)")] 12 | public bool WaitForWintergrasp { get; set; } 13 | 14 | [YamlMember(Description = "Whether or not to enable sound setup (max win sound + mute) (Default: false)")] 15 | public bool SetupSound { get; set; } 16 | 17 | [YamlMember(Description = "Keyboard key binding for fishing cast (Default: 1)")] 18 | public string KeyboardKeyStartFishing { get; set; } 19 | 20 | [YamlMember(Description = "Keyboard key binding for applying lure (optional, Default: 2)")] 21 | public string KeyboardKeyApplyLure { get; set; } 22 | 23 | [YamlMember(Description = "Keyboard key binding for applying a second lure (optional)")] 24 | public string? KeyboardKeyApplySecondLure { get; set; } 25 | 26 | [YamlMember(Description = "Buff duration of first lure (mandatory if first lure keybind is set, Default: 10)")] 27 | public int LureBuffDurationMinutes { get; set; } 28 | 29 | [YamlMember(Description = "Buff duration of second lure (mandatory if second lure keybind is set)")] 30 | public int? SecondLureBuffDurationMinutes { get; set; } 31 | 32 | [YamlMember(Description = "Fishing cast duration in seconds (Default: 20)")] 33 | public int FishingChannelDurationSeconds { get; set; } 34 | 35 | [YamlMember(Description = "Window name of the game, when you hover over it in the taskbar")] 36 | public string GameWindowName { get; set; } 37 | 38 | [YamlMember(Description = "Use interact key instead of mouse clicking for fishing (requires WoW expansion with interact feature, Default: false)")] 39 | public bool UseInteractKey { get; set; } 40 | 41 | [YamlMember(Description = "Keyboard key binding for interact with target (Default: f)")] 42 | public string KeyboardKeyInteract { get; set; } 43 | 44 | public Properties() 45 | { 46 | KeyboardPressLogout = KeyboardUtils.ConvertToString(Keys.D3); 47 | WaitForWintergrasp = false; 48 | KeyboardKeyStartFishing = KeyboardUtils.ConvertToString(Keys.D1); 49 | KeyboardKeyApplyLure = KeyboardUtils.ConvertToString(Keys.D2); 50 | KeyboardKeyApplySecondLure = null; 51 | LureBuffDurationMinutes = TimeSpan.FromMinutes(10).Minutes; 52 | SecondLureBuffDurationMinutes = null; 53 | FishingChannelDurationSeconds = TimeSpan.FromSeconds(20).Seconds; 54 | GameWindowName = "Game Window Name"; 55 | UseInteractKey = false; 56 | KeyboardKeyInteract = "f"; 57 | } 58 | } -------------------------------------------------------------------------------- /Phishy/FishingStateMachine.cs: -------------------------------------------------------------------------------- 1 | using Phishy.Configs; 2 | using Phishy.Interfaces; 3 | using Phishy.Utils; 4 | 5 | namespace Phishy; 6 | 7 | public enum FishingState 8 | { 9 | Start, 10 | Logout, 11 | Login, 12 | WaitForWintergrasp, 13 | ApplyLure, 14 | ApplySecondLure, 15 | CastLine, 16 | FindBobber, 17 | WaitAndCatch, 18 | CatchFish 19 | } 20 | 21 | public class FishingStateMachine : IFishingStateMachine 22 | { 23 | private FishingState _currentState; 24 | private bool _isLineCast; 25 | private bool _isBobberDipped; 26 | private bool _isBobberFound; 27 | private readonly object _bobberLock = new object(); 28 | 29 | private DateTime _lastLureApplyTime; 30 | private DateTime _lastApplyTimeSecondLure; 31 | 32 | public FishingStateMachine() 33 | { 34 | _currentState = FishingState.Start; 35 | _lastLureApplyTime = DateTime.Now.AddDays(-69); 36 | _lastApplyTimeSecondLure = DateTime.Now.AddDays(-69); 37 | } 38 | 39 | public void Update(CancellationToken cancellationToken) 40 | { 41 | switch (_currentState) 42 | { 43 | case FishingState.Start: 44 | //TODO add this logic to a TryTransition method and every state should check this 45 | if (WindowUtils.GetForegroundWindowName() != AppConfig.Props.GameWindowName) 46 | { 47 | Console.WriteLine($"[FishingStateMachine]: Open game window [{AppConfig.Props.GameWindowName}]..."); 48 | Thread.Sleep(TimeSpan.FromSeconds(1)); 49 | break; 50 | } 51 | 52 | _isBobberDipped = _isLineCast = false; 53 | lock (_bobberLock) 54 | { 55 | _isBobberFound = false; 56 | } 57 | 58 | if (!AppConfig.Props.UseInteractKey) 59 | { 60 | Console.WriteLine("[FishingStateMachine]: Moving to center of screen..."); 61 | MouseUtils.MoveToCenterOfWindow(AppConfig.Props.GameWindowName, true, 100); 62 | } 63 | else 64 | { 65 | Console.WriteLine("[FishingStateMachine]: Interact mode enabled - skipping mouse positioning..."); 66 | } 67 | 68 | TryTransition(); 69 | break; 70 | case FishingState.Logout: 71 | Console.WriteLine("[FishingStateMachine]: Logging out..."); 72 | Logout(); 73 | TryTransition(); 74 | break; 75 | case FishingState.WaitForWintergrasp: 76 | if (IsWintergraspRunning()) 77 | { 78 | Console.WriteLine("[FishingStateMachine]: Wintergrasp is running... sleeping 10 secs"); 79 | Thread.Sleep(TimeSpan.FromSeconds(10)); 80 | break; 81 | } 82 | Console.WriteLine("[FishingStateMachine]: Wintergrasp is no longer running, resuming..."); 83 | 84 | TryTransition(); 85 | break; 86 | case FishingState.Login: 87 | Console.WriteLine("[FishingStateMachine]: Logging in..."); 88 | Login(); 89 | TryTransition(); 90 | break; 91 | case FishingState.ApplyLure: 92 | Console.WriteLine("[FishingStateMachine]: Applying lure..."); 93 | 94 | ApplyLure(); 95 | _lastLureApplyTime = DateTime.Now; 96 | 97 | TryTransition(); 98 | break; 99 | case FishingState.ApplySecondLure: 100 | Console.WriteLine("[FishingStateMachine]: Applying second lure..."); 101 | 102 | ApplySecondLure(); 103 | _lastApplyTimeSecondLure = DateTime.Now; 104 | 105 | TryTransition(); 106 | break; 107 | case FishingState.CastLine: 108 | Console.WriteLine("[FishingStateMachine]: Casting the fishing line..."); 109 | 110 | CastLine(); 111 | _isLineCast = true; 112 | 113 | TryTransition(); 114 | break; 115 | 116 | case FishingState.FindBobber: 117 | Console.WriteLine("[FishingStateMachine]: Looking for the bobber..."); 118 | 119 | FindBobber(cancellationToken); 120 | 121 | TryTransition(); 122 | break; 123 | case FishingState.WaitAndCatch: 124 | Console.WriteLine("[FishingStateMachine]: Waiting for a fish to bite..."); 125 | ListenForFish(cancellationToken, TimeSpan.FromSeconds(AppConfig.Props.FishingChannelDurationSeconds)); 126 | Console.WriteLine("[FishingStateMachine]: Stopped listening for fish."); 127 | 128 | TryTransition(); 129 | break; 130 | case FishingState.CatchFish: 131 | Console.WriteLine("[FishingStateMachine]: You caught a fish!"); 132 | 133 | if (AppConfig.Props.UseInteractKey) 134 | { 135 | Console.WriteLine($"[FishingStateMachine]: Using interact key: {AppConfig.Props.KeyboardKeyInteract}"); 136 | KeyboardUtils.SendKeyInput(AppConfig.Props.KeyboardKeyInteract); 137 | } 138 | else 139 | { 140 | MouseUtils.SendMouseInput(MouseButtons.Right); 141 | } 142 | _isLineCast = false; 143 | Thread.Sleep(TimeSpan.FromSeconds(1)); 144 | 145 | TryTransition(); 146 | break; 147 | } 148 | } 149 | 150 | private void TryTransition() 151 | { 152 | switch (_currentState) 153 | { 154 | case FishingState.Start: 155 | FishingState newState; 156 | 157 | if (AppConfig.Props.WaitForWintergrasp && (IsWintergraspAboutToBegin() || IsWintergraspRunning())) 158 | { 159 | newState = FishingState.Logout; 160 | } 161 | else if (!string.IsNullOrWhiteSpace(AppConfig.Props.KeyboardKeyApplyLure) 162 | && (DateTime.Now - _lastLureApplyTime > TimeSpan.FromMinutes(AppConfig.Props.LureBuffDurationMinutes))) 163 | newState = FishingState.ApplyLure; 164 | else 165 | newState = FishingState.CastLine; 166 | 167 | TransitionTo(newState); 168 | break; 169 | case FishingState.Logout: 170 | TransitionTo(FishingState.WaitForWintergrasp); 171 | break; 172 | case FishingState.WaitForWintergrasp: 173 | TransitionTo(FishingState.Login); 174 | break; 175 | case FishingState.Login: 176 | TransitionTo(FishingState.Start); 177 | break; 178 | case FishingState.ApplyLure: 179 | if (AppConfig.Props.SecondLureBuffDurationMinutes.HasValue && AppConfig.Props.SecondLureBuffDurationMinutes > 0) 180 | { 181 | if (DateTime.Now - _lastApplyTimeSecondLure > TimeSpan.FromMinutes(AppConfig.Props.SecondLureBuffDurationMinutes.Value)) 182 | { 183 | TransitionTo(FishingState.ApplySecondLure); 184 | break; 185 | } 186 | } 187 | 188 | TransitionTo(FishingState.CastLine); 189 | break; 190 | case FishingState.ApplySecondLure: 191 | TransitionTo(FishingState.CastLine); 192 | break; 193 | case FishingState.CastLine: 194 | if (_isLineCast) 195 | { 196 | if (AppConfig.Props.UseInteractKey) 197 | { 198 | TransitionTo(FishingState.WaitAndCatch); 199 | } 200 | else 201 | { 202 | TransitionTo(FishingState.FindBobber); 203 | } 204 | } 205 | break; 206 | case FishingState.FindBobber: 207 | // TODO: cover the case when line is cast but bobber is not found in time and make findBobber async 208 | bool bobberFound; 209 | lock (_bobberLock) 210 | { 211 | bobberFound = _isBobberFound; 212 | } 213 | 214 | if (bobberFound && _isLineCast) 215 | { 216 | TransitionTo(FishingState.WaitAndCatch); 217 | } 218 | else 219 | { 220 | TransitionTo(FishingState.Start); 221 | } 222 | break; 223 | case FishingState.WaitAndCatch: 224 | if (_isBobberDipped) 225 | { 226 | Console.WriteLine("[FishingStateMachine]: DIP!"); 227 | _isBobberDipped = false; 228 | lock (_bobberLock) 229 | { 230 | _isBobberFound = false; 231 | } 232 | TransitionTo(FishingState.CatchFish); 233 | } 234 | else 235 | { 236 | TransitionTo(FishingState.Start); 237 | } 238 | break; 239 | case FishingState.CatchFish: 240 | TransitionTo(FishingState.Start); 241 | break; 242 | default: 243 | throw new ArgumentOutOfRangeException(nameof(_currentState), _currentState, null); 244 | } 245 | } 246 | 247 | private void TransitionTo(FishingState state) 248 | { 249 | _currentState = state; 250 | } 251 | 252 | private void ApplySecondLure() 253 | { 254 | if (string.IsNullOrWhiteSpace(AppConfig.Props.KeyboardKeyApplySecondLure)) 255 | { 256 | Console.WriteLine("[FishingStateMachine]: Can't apply second lure, invalid button configured."); 257 | return; 258 | } 259 | 260 | KeyboardUtils.SendKeyInput(AppConfig.Props.KeyboardKeyApplySecondLure); 261 | Thread.Sleep(TimeSpan.FromSeconds(3)); 262 | } 263 | 264 | private void ApplyLure() 265 | { 266 | KeyboardUtils.SendKeyInput(AppConfig.Props.KeyboardKeyApplyLure); 267 | Thread.Sleep(TimeSpan.FromSeconds(3)); 268 | } 269 | 270 | private void CastLine() 271 | { 272 | KeyboardUtils.SendKeyInput(AppConfig.Props.KeyboardKeyStartFishing); 273 | } 274 | 275 | private void FindBobber(CancellationToken cancellationToken) 276 | { 277 | MouseUtils.MoveMouseFibonacci(cancellationToken, AppConfig.Props.GameWindowName, () => 278 | { 279 | lock (_bobberLock) 280 | { 281 | return _isBobberFound; 282 | } 283 | }); 284 | } 285 | 286 | private void ListenForFish(CancellationToken cancellationToken, TimeSpan timeoutInSeconds) 287 | { 288 | DateTime lastLineCastTime = DateTime.Now; 289 | DateTime lastLogTime = DateTime.Now; 290 | int checkCount = 0; 291 | float maxSoundLevel = 0f; 292 | const float FISH_DETECTION_THRESHOLD = 0.1f; 293 | 294 | string mode = AppConfig.Props.UseInteractKey ? "interact key" : "mouse click"; 295 | Console.WriteLine($"[FishingStateMachine]: Starting to listen for fish splash (threshold: {FISH_DETECTION_THRESHOLD}, mode: {mode})..."); 296 | 297 | while (!cancellationToken.IsCancellationRequested) 298 | { 299 | bool bobberFound; 300 | lock (_bobberLock) 301 | { 302 | bobberFound = _isBobberFound; 303 | } 304 | 305 | float currentSoundLevel = AudioUtils.GetMasterVolumeLevel(); 306 | checkCount++; 307 | 308 | if (currentSoundLevel > maxSoundLevel) 309 | { 310 | maxSoundLevel = currentSoundLevel; 311 | } 312 | 313 | // Log every 5 seconds or when significant sound detected (higher threshold) 314 | if (DateTime.Now - lastLogTime > TimeSpan.FromSeconds(5) || currentSoundLevel > 0.05f) 315 | { 316 | string statusMsg = AppConfig.Props.UseInteractKey 317 | ? $"Interact mode: Ready, Current sound: {currentSoundLevel:F4}, Max sound: {maxSoundLevel:F4}, Checks: {checkCount}" 318 | : $"Bobber found: {bobberFound}, Current sound: {currentSoundLevel:F4}, Max sound: {maxSoundLevel:F4}, Checks: {checkCount}"; 319 | Console.WriteLine($"[FishingStateMachine]: Listening... {statusMsg}"); 320 | lastLogTime = DateTime.Now; 321 | } 322 | 323 | bool canDetectFish = AppConfig.Props.UseInteractKey || bobberFound; 324 | 325 | if (canDetectFish && currentSoundLevel > FISH_DETECTION_THRESHOLD) 326 | { 327 | Console.WriteLine($"[FishingStateMachine]: FISH DETECTED! Sound level: {currentSoundLevel:F4} (threshold: {FISH_DETECTION_THRESHOLD})"); 328 | _isBobberDipped = true; 329 | break; 330 | } 331 | 332 | //TODO move this outside and check during tryTransition and possibly cancel through token 333 | if (DateTime.Now - lastLineCastTime > timeoutInSeconds) 334 | { 335 | Console.WriteLine($"[FishingStateMachine]: Timeout after {timeoutInSeconds.TotalSeconds} seconds! Max sound detected: {maxSoundLevel:F4}"); 336 | break; 337 | } 338 | 339 | Thread.Sleep(TimeSpan.FromMilliseconds(100)); 340 | } 341 | } 342 | 343 | public void NotifyBobberFound() 344 | { 345 | lock (_bobberLock) 346 | { 347 | if (_isLineCast) 348 | { 349 | _isBobberFound = true; 350 | } 351 | } 352 | } 353 | 354 | public static bool IsWintergraspAboutToBegin() 355 | { 356 | TimeSpan currentTimeOfDay = DateTime.Now.TimeOfDay; 357 | 358 | for (int hour = 0; hour < 24; hour += 3) 359 | { 360 | TimeSpan wgStartTime = TimeSpan.FromHours(hour + 1); 361 | TimeSpan fewMinutesBeforeWgStart = wgStartTime.Subtract(TimeSpan.FromMinutes(5)); 362 | 363 | if (fewMinutesBeforeWgStart < TimeSpan.Zero) 364 | { 365 | fewMinutesBeforeWgStart = TimeSpan.Zero; 366 | } 367 | 368 | if (currentTimeOfDay >= fewMinutesBeforeWgStart && currentTimeOfDay <= wgStartTime) 369 | { 370 | return true; 371 | } 372 | } 373 | 374 | return false; 375 | } 376 | 377 | public static bool IsWintergraspRunning() 378 | { 379 | TimeSpan currentTimeOfDay = DateTime.Now.TimeOfDay; 380 | 381 | for (int hour = 0; hour < 24; hour += 3) 382 | { 383 | TimeSpan wgStartTime = TimeSpan.FromHours(hour + 1); 384 | TimeSpan wgEndTime = wgStartTime + TimeSpan.FromMinutes(30); 385 | 386 | // Check 10 minutes before start and 10 minutes after end just to be sure we won't be kicked from WG 387 | if (currentTimeOfDay - TimeSpan.FromMinutes(10) >= wgStartTime && currentTimeOfDay <= wgEndTime + TimeSpan.FromMinutes(10)) 388 | { 389 | return true; 390 | } 391 | } 392 | 393 | 394 | return false; 395 | } 396 | 397 | private void Logout() 398 | { 399 | if (string.IsNullOrWhiteSpace(AppConfig.Props.KeyboardPressLogout)) 400 | { 401 | Console.WriteLine("[FishingStateMachine]: Can't logout, invalid button configured."); 402 | return; 403 | } 404 | 405 | KeyboardUtils.SendKeyInput(AppConfig.Props.KeyboardPressLogout); 406 | Thread.Sleep(TimeSpan.FromSeconds(3)); 407 | } 408 | private void Login() 409 | { 410 | KeyboardUtils.SendKeyInput("ENTER"); 411 | Thread.Sleep(TimeSpan.FromSeconds(10)); 412 | } 413 | } -------------------------------------------------------------------------------- /Phishy/Hooks/KeyboardHook.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace Phishy.Hooks 5 | { 6 | internal sealed class KeyboardHook 7 | { 8 | private const int WH_KEYBOARD_LL = 13; 9 | private const int WM_KEYDOWN = 0x0100; 10 | private const int WM_SYSKEYDOWN = 0x0104; 11 | private const int WM_KEYUP = 0x101; 12 | private const int WM_SYSKEYUP = 0x105; 13 | 14 | [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] 15 | private static extern IntPtr SetWindowsHookEx(int idHook, LowLevelKeyboardProc lpfn, IntPtr hMod, uint dwThreadId); 16 | 17 | [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] 18 | [return: MarshalAs(UnmanagedType.Bool)] 19 | private static extern bool UnhookWindowsHookEx(IntPtr hhk); 20 | 21 | [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] 22 | private static extern IntPtr CallNextHookEx(IntPtr hhk, int nCode, IntPtr wParam, IntPtr lParam); 23 | 24 | [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)] 25 | private static extern IntPtr GetModuleHandle(string lpModuleName); 26 | 27 | private delegate IntPtr LowLevelKeyboardProc(int nCode, IntPtr wParam, IntPtr lParam); 28 | private readonly LowLevelKeyboardProc _proc; 29 | private IntPtr _hookId = IntPtr.Zero; 30 | 31 | public event EventHandler? OnKeyPressed; 32 | public event EventHandler? OnKeyReleased; 33 | 34 | public KeyboardHook() 35 | { 36 | _proc = HookCallback; 37 | } 38 | 39 | public void HookKeyboard() 40 | { 41 | _hookId = SetHook(_proc); 42 | if (_hookId == IntPtr.Zero) 43 | { 44 | int error = Marshal.GetLastWin32Error(); 45 | throw new InvalidOperationException($"Failed to install keyboard hook. Error: {error}"); 46 | } 47 | } 48 | 49 | public void UnHookKeyboard() 50 | { 51 | if (_hookId != IntPtr.Zero) 52 | { 53 | if (!UnhookWindowsHookEx(_hookId)) 54 | { 55 | int error = Marshal.GetLastWin32Error(); 56 | Console.WriteLine($"[KeyboardHook]: Failed to unhook keyboard. Error: {error}"); 57 | } 58 | _hookId = IntPtr.Zero; 59 | } 60 | } 61 | 62 | private IntPtr SetHook(LowLevelKeyboardProc proc) 63 | { 64 | using Process curProcess = Process.GetCurrentProcess(); 65 | using ProcessModule? curModule = curProcess.MainModule; 66 | if (curModule == null) 67 | { 68 | Console.WriteLine("[KeyboardHook]: Failed to get current module"); 69 | return IntPtr.Zero; 70 | } 71 | 72 | IntPtr moduleHandle = GetModuleHandle(curModule.ModuleName); 73 | if (moduleHandle == IntPtr.Zero) 74 | { 75 | int error = Marshal.GetLastWin32Error(); 76 | Console.WriteLine($"[KeyboardHook]: Failed to get module handle. Error: {error}"); 77 | return IntPtr.Zero; 78 | } 79 | 80 | return SetWindowsHookEx(WH_KEYBOARD_LL, proc, moduleHandle, 0); 81 | } 82 | 83 | private IntPtr HookCallback(int nCode, IntPtr wParam, IntPtr lParam) 84 | { 85 | if (nCode >= 0 && wParam == WM_KEYDOWN || wParam == WM_SYSKEYDOWN) 86 | { 87 | int vkCode = Marshal.ReadInt32(lParam); 88 | 89 | OnKeyPressed?.Invoke(this, (Keys)vkCode); 90 | } 91 | else if (nCode >= 0 && wParam == WM_KEYUP || wParam == WM_SYSKEYUP) 92 | { 93 | int vkCode = Marshal.ReadInt32(lParam); 94 | 95 | OnKeyReleased?.Invoke(this, (Keys)vkCode); 96 | } 97 | 98 | return CallNextHookEx(_hookId, nCode, wParam, lParam); 99 | } 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /Phishy/Hooks/MouseHook.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | 3 | namespace Phishy.Hooks 4 | { 5 | internal sealed class MouseHook 6 | { 7 | private const int WH_MOUSE_LL = 14; 8 | private const IntPtr WM_MOUSEMOVE = 0x0200; 9 | 10 | [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] 11 | private static extern IntPtr SetWindowsHookEx(int idHook, LowLevelMouseProc lpfn, IntPtr hMod, uint dwThreadId); 12 | 13 | [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] 14 | [return: MarshalAs(UnmanagedType.Bool)] 15 | private static extern bool UnhookWindowsHookEx(IntPtr hhk); 16 | 17 | [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] 18 | private static extern IntPtr CallNextHookEx(IntPtr hhk, int nCode, IntPtr wParam, IntPtr lParam); 19 | 20 | [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)] 21 | private static extern IntPtr GetModuleHandle(string lpModuleName); 22 | 23 | private delegate IntPtr LowLevelMouseProc(int nCode, IntPtr wParam, IntPtr lParam); 24 | private readonly LowLevelMouseProc _hookProcDelegate; 25 | private IntPtr _hookId = IntPtr.Zero; 26 | 27 | public event EventHandler? OnCursorMove; 28 | 29 | public MouseHook() 30 | { 31 | _hookProcDelegate = HookCallback; 32 | } 33 | 34 | private IntPtr HookCallback(int nCode, IntPtr wParam, IntPtr lParam) 35 | { 36 | if (nCode >= 0) 37 | { 38 | if (wParam == WM_MOUSEMOVE) 39 | { 40 | int x = Marshal.ReadInt32(lParam); 41 | int y = Marshal.ReadInt32(lParam + 4); 42 | 43 | OnCursorMove?.Invoke(this, $"[MouseHook]: Mouse moved to X:{x}, Y:{y}"); 44 | } 45 | else 46 | { 47 | Console.WriteLine($"[MouseHook]: DEBUG: {wParam:X}"); 48 | } 49 | } 50 | 51 | return CallNextHookEx(_hookId, nCode, wParam, lParam); 52 | } 53 | 54 | public void HookMouse() 55 | { 56 | _hookId = SetHook(_hookProcDelegate); 57 | if (_hookId == IntPtr.Zero) 58 | { 59 | int error = Marshal.GetLastWin32Error(); 60 | throw new InvalidOperationException($"Failed to install mouse hook. Error: {error}"); 61 | } 62 | } 63 | 64 | public void UnHookMouse() 65 | { 66 | if (_hookId != IntPtr.Zero) 67 | { 68 | if (!UnhookWindowsHookEx(_hookId)) 69 | { 70 | int error = Marshal.GetLastWin32Error(); 71 | Console.WriteLine($"[MouseHook]: Failed to unhook mouse. Error: {error}"); 72 | } 73 | _hookId = IntPtr.Zero; 74 | } 75 | } 76 | 77 | private IntPtr SetHook(LowLevelMouseProc hookProcDelegate) 78 | { 79 | using var curProcess = System.Diagnostics.Process.GetCurrentProcess(); 80 | using var curModule = curProcess.MainModule; 81 | if (curModule == null) 82 | { 83 | Console.WriteLine("[MouseHook]: Failed to get current module"); 84 | return IntPtr.Zero; 85 | } 86 | 87 | IntPtr moduleHandle = GetModuleHandle(curModule.ModuleName); 88 | if (moduleHandle == IntPtr.Zero) 89 | { 90 | int error = Marshal.GetLastWin32Error(); 91 | Console.WriteLine($"[MouseHook]: Failed to get module handle. Error: {error}"); 92 | return IntPtr.Zero; 93 | } 94 | 95 | return SetWindowsHookEx(WH_MOUSE_LL, hookProcDelegate, moduleHandle, 0); 96 | } 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /Phishy/Hooks/WinEventHook.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | 3 | namespace Phishy.Hooks 4 | { 5 | internal sealed class WinEventHook 6 | { 7 | private const uint EVENT_OBJECT_NAMECHANGE = 0x800C; 8 | private const uint WINEVENT_OUTOFCONTEXT = 0x0000; 9 | private const uint WINEVENT_SKIPOWNPROCESS = 0x0002; 10 | private const long OBJID_CURSOR = 0xFFFFFFF7; 11 | 12 | private delegate void WinEventProc(IntPtr hWinEventHook, uint eventType, IntPtr hwnd, long idObject, long idChild, uint dwEventThread, uint dwmsEventTime); 13 | private readonly WinEventProc _hookProcDelegate; 14 | private IntPtr _hookId = IntPtr.Zero; 15 | 16 | public event EventHandler? OnCursorIconChange; 17 | 18 | [DllImport("user32.dll", SetLastError = true)] 19 | private static extern IntPtr SetWinEventHook(uint eventMin, uint eventMax, IntPtr hmodWinEventProc, WinEventProc lpfnWinEventProc, uint idProcess, uint idThread, uint dwFlags); 20 | 21 | [DllImport("user32.dll", SetLastError = true)] 22 | private static extern bool UnhookWinEvent(IntPtr hWinEventHook); 23 | 24 | public WinEventHook() 25 | { 26 | _hookProcDelegate = HookCallback; 27 | } 28 | 29 | private void HookCallback(IntPtr hWinEventHook, uint eventType, IntPtr hwnd, long idObject, long idChild, uint dwEventThread, uint dwmsEventTime) 30 | { 31 | if (idObject == OBJID_CURSOR) 32 | { 33 | if (eventType == EVENT_OBJECT_NAMECHANGE) 34 | { 35 | OnCursorIconChange?.Invoke(this, "[WinEventHook]: Cursor changed!"); 36 | } 37 | } 38 | } 39 | 40 | public void HookWinEvent(uint processId) 41 | { 42 | _hookId = SetHook(processId, _hookProcDelegate); 43 | if (_hookId == IntPtr.Zero) 44 | { 45 | int error = Marshal.GetLastWin32Error(); 46 | throw new InvalidOperationException($"Failed to install WinEvent hook. Error: {error}"); 47 | } 48 | } 49 | 50 | public void UnHookWinEvent() 51 | { 52 | if (_hookId != IntPtr.Zero) 53 | { 54 | if (!UnhookWinEvent(_hookId)) 55 | { 56 | int error = Marshal.GetLastWin32Error(); 57 | Console.WriteLine($"[WinEventHook]: Failed to unhook WinEvent. Error: {error}"); 58 | } 59 | _hookId = IntPtr.Zero; 60 | } 61 | } 62 | 63 | private IntPtr SetHook(uint processId, WinEventProc hookProcDelegate) 64 | { 65 | return SetWinEventHook(EVENT_OBJECT_NAMECHANGE, EVENT_OBJECT_NAMECHANGE, IntPtr.Zero, hookProcDelegate, processId, 0, WINEVENT_OUTOFCONTEXT | WINEVENT_SKIPOWNPROCESS); 66 | } 67 | 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /Phishy/Interfaces/IAudioDetector.cs: -------------------------------------------------------------------------------- 1 | namespace Phishy.Interfaces; 2 | 3 | public interface IAudioDetector 4 | { 5 | float GetMasterVolumeLevel(); 6 | void SetVolumeToMax(); 7 | void MuteSound(); 8 | } -------------------------------------------------------------------------------- /Phishy/Interfaces/IFishingStateMachine.cs: -------------------------------------------------------------------------------- 1 | namespace Phishy.Interfaces; 2 | 3 | public interface IFishingStateMachine 4 | { 5 | void Update(CancellationToken cancellationToken); 6 | void NotifyBobberFound(); 7 | } -------------------------------------------------------------------------------- /Phishy/Interfaces/IHook.cs: -------------------------------------------------------------------------------- 1 | namespace Phishy.Interfaces; 2 | 3 | public interface IHook : IDisposable 4 | { 5 | void Install(); 6 | void Uninstall(); 7 | bool IsInstalled { get; } 8 | } -------------------------------------------------------------------------------- /Phishy/Interfaces/IInputSimulator.cs: -------------------------------------------------------------------------------- 1 | namespace Phishy.Interfaces; 2 | 3 | public interface IInputSimulator 4 | { 5 | void SendMouseInput(MouseButtons button); 6 | void MoveToCenterOfWindow(string windowName, bool smoothly, int heightCorrectionPixels); 7 | void MoveMouseFibonacci(CancellationToken cancellationToken, string windowName, Func isBobberFound); 8 | void SendKeyInput(string key); 9 | } -------------------------------------------------------------------------------- /Phishy/Interfaces/ILogger.cs: -------------------------------------------------------------------------------- 1 | namespace Phishy.Interfaces; 2 | 3 | public interface ILogger 4 | { 5 | void LogInfo(string message); 6 | void LogWarning(string message); 7 | void LogError(string message, Exception? exception = null); 8 | void LogDebug(string message); 9 | } -------------------------------------------------------------------------------- /Phishy/Interfaces/IWindowManager.cs: -------------------------------------------------------------------------------- 1 | namespace Phishy.Interfaces; 2 | 3 | public interface IWindowManager 4 | { 5 | Point? GetWindowCenterPoint(string windowName); 6 | uint GetProcessIdByWindowName(string windowName); 7 | string GetForegroundWindowName(); 8 | } -------------------------------------------------------------------------------- /Phishy/Phishy.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | Exe 4 | net9.0-windows 5 | Phishy 6 | enable 7 | enable 8 | True 9 | guess 10 | 11 | true 12 | true 13 | true 14 | embedded 15 | true 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /Phishy/Program.cs: -------------------------------------------------------------------------------- 1 | using Phishy.Configs; 2 | using Phishy.Hooks; 3 | using Phishy.Utils; 4 | 5 | namespace Phishy 6 | { 7 | class Program 8 | { 9 | private static readonly KeyboardHook KeyboardHook = new(); 10 | private static readonly MouseHook MouseHook = new(); 11 | private static readonly WinEventHook WinEventHook = new(); 12 | private static readonly FishingStateMachine FishingStateMachine = new(); 13 | 14 | private static async Task Main() 15 | { 16 | Console.CursorVisible = false; 17 | 18 | Console.WriteLine("[Main]: Loading app properties"); 19 | if (!AppConfig.LoadProperties()) 20 | { 21 | Console.WriteLine("[Main]: Failed to load app properties, exiting..."); 22 | return; 23 | } 24 | 25 | if (AppConfig.Props.SetupSound) 26 | { 27 | Console.WriteLine("[Main]: Audio setup enabled - configuring audio settings..."); 28 | 29 | Console.WriteLine("[Main]: Audio state BEFORE configuration:"); 30 | AudioUtils.LogAudioDeviceInfo(); 31 | 32 | Console.WriteLine("[Main]: Setting win volume to max..."); 33 | AudioUtils.SetVolumeToMax(); 34 | 35 | Console.WriteLine("[Main]: Muting sound..."); 36 | AudioUtils.MuteSound(); 37 | 38 | Console.WriteLine("[Main]: Audio state AFTER configuration:"); 39 | AudioUtils.LogAudioDeviceInfo(); 40 | } 41 | else 42 | { 43 | Console.WriteLine("[Main]: Audio setup disabled in config (SetupSound = false)"); 44 | Console.WriteLine("[Main]: Current audio state:"); 45 | AudioUtils.LogAudioDeviceInfo(); 46 | } 47 | 48 | CancellationTokenSource cancellationTokenSource = new CancellationTokenSource(); 49 | 50 | Task initMessageLoopAndHooks = Task.Run(() => { InitHooksAndMessageLoop(cancellationTokenSource.Token); }); 51 | 52 | WinEventHook.OnCursorIconChange += (_, e) => { Console.WriteLine('\n' + e); FishingStateMachine.NotifyBobberFound(); }; 53 | 54 | Task stateMachineTask = Task.Run(() => 55 | { 56 | while (!cancellationTokenSource.IsCancellationRequested) 57 | { 58 | FishingStateMachine.Update(cancellationTokenSource.Token); 59 | Thread.Sleep(50); 60 | } 61 | }); 62 | 63 | Console.WriteLine("[Main]: Started, press END to stop"); 64 | while (Console.ReadKey().Key != ConsoleKey.End) 65 | { 66 | Thread.Sleep(100); 67 | } 68 | 69 | cancellationTokenSource.Cancel(); 70 | Application.Exit(); 71 | Console.WriteLine("[Main]: Message loop stopped"); 72 | await initMessageLoopAndHooks.WaitAsync(TimeSpan.FromSeconds(5)).ConfigureAwait(false); 73 | await stateMachineTask.WaitAsync(TimeSpan.FromSeconds(5)).ConfigureAwait(false); 74 | 75 | Console.WriteLine("[Main]: Unhooking..."); 76 | KeyboardHook.UnHookKeyboard(); 77 | MouseHook.UnHookMouse(); 78 | WinEventHook.UnHookWinEvent(); 79 | } 80 | 81 | private static void InitHooksAndMessageLoop(CancellationToken cancellationToken) 82 | { 83 | uint processId = WindowUtils.GetProcessIdByWindowName(AppConfig.Props.GameWindowName); 84 | while (processId == 0) 85 | { 86 | if (cancellationToken.IsCancellationRequested) 87 | { 88 | Console.WriteLine("[Main]: Cancellation requested, exiting InitHooksAndMessageLoop"); 89 | return; 90 | } 91 | 92 | Console.WriteLine("[Main]: Failed to get processId, will retry!"); 93 | Thread.Sleep(2000); 94 | processId = WindowUtils.GetProcessIdByWindowName(AppConfig.Props.GameWindowName); 95 | } 96 | 97 | Console.WriteLine($"[Main]: Got process ID: {processId}"); 98 | WinEventHook.HookWinEvent(processId); 99 | 100 | Application.Run(); 101 | } 102 | } 103 | } -------------------------------------------------------------------------------- /Phishy/Services/AudioDetector.cs: -------------------------------------------------------------------------------- 1 | using Phishy.Interfaces; 2 | using Phishy.Utils; 3 | 4 | namespace Phishy.Services; 5 | 6 | public class AudioDetector : IAudioDetector 7 | { 8 | public float GetMasterVolumeLevel() 9 | { 10 | return AudioUtils.GetMasterVolumeLevel(); 11 | } 12 | 13 | public void SetVolumeToMax() 14 | { 15 | AudioUtils.SetVolumeToMax(); 16 | } 17 | 18 | public void MuteSound() 19 | { 20 | AudioUtils.MuteSound(); 21 | } 22 | } -------------------------------------------------------------------------------- /Phishy/Services/ConsoleLogger.cs: -------------------------------------------------------------------------------- 1 | using Phishy.Interfaces; 2 | 3 | namespace Phishy.Services; 4 | 5 | public class ConsoleLogger : ILogger 6 | { 7 | private readonly string _prefix; 8 | private readonly object _lock = new object(); 9 | 10 | public ConsoleLogger(string prefix = "") 11 | { 12 | _prefix = string.IsNullOrEmpty(prefix) ? "" : $"[{prefix}]: "; 13 | } 14 | 15 | public void LogInfo(string message) 16 | { 17 | Log("INFO", message, ConsoleColor.White); 18 | } 19 | 20 | public void LogWarning(string message) 21 | { 22 | Log("WARN", message, ConsoleColor.Yellow); 23 | } 24 | 25 | public void LogError(string message, Exception? exception = null) 26 | { 27 | var fullMessage = exception != null 28 | ? $"{message} - {exception.GetType().Name}: {exception.Message}" 29 | : message; 30 | 31 | Log("ERROR", fullMessage, ConsoleColor.Red); 32 | 33 | if (exception?.StackTrace != null) 34 | { 35 | Log("ERROR", exception.StackTrace, ConsoleColor.DarkRed); 36 | } 37 | } 38 | 39 | public void LogDebug(string message) 40 | { 41 | #if DEBUG 42 | Log("DEBUG", message, ConsoleColor.Gray); 43 | #endif 44 | } 45 | 46 | private void Log(string level, string message, ConsoleColor color) 47 | { 48 | lock (_lock) 49 | { 50 | var timestamp = DateTime.Now.ToString("HH:mm:ss"); 51 | var originalColor = Console.ForegroundColor; 52 | 53 | Console.ForegroundColor = ConsoleColor.DarkGray; 54 | Console.Write($"[{timestamp}] "); 55 | 56 | Console.ForegroundColor = color; 57 | Console.Write($"[{level}] "); 58 | 59 | Console.ForegroundColor = originalColor; 60 | Console.WriteLine($"{_prefix}{message}"); 61 | } 62 | } 63 | } -------------------------------------------------------------------------------- /Phishy/Services/InputSimulator.cs: -------------------------------------------------------------------------------- 1 | using Phishy.Interfaces; 2 | using Phishy.Utils; 3 | 4 | namespace Phishy.Services; 5 | 6 | public class InputSimulator : IInputSimulator 7 | { 8 | public void SendMouseInput(MouseButtons button) 9 | { 10 | MouseUtils.SendMouseInput(button); 11 | } 12 | 13 | public void MoveToCenterOfWindow(string windowName, bool smoothly, int heightCorrectionPixels) 14 | { 15 | MouseUtils.MoveToCenterOfWindow(windowName, smoothly, heightCorrectionPixels); 16 | } 17 | 18 | public void MoveMouseFibonacci(CancellationToken cancellationToken, string windowName, Func isBobberFound) 19 | { 20 | MouseUtils.MoveMouseFibonacci(cancellationToken, windowName, isBobberFound); 21 | } 22 | 23 | public void SendKeyInput(string key) 24 | { 25 | KeyboardUtils.SendKeyInput(key); 26 | } 27 | } -------------------------------------------------------------------------------- /Phishy/Services/WindowManager.cs: -------------------------------------------------------------------------------- 1 | using Phishy.Interfaces; 2 | using Phishy.Utils; 3 | 4 | namespace Phishy.Services; 5 | 6 | public class WindowManager : IWindowManager 7 | { 8 | public Point? GetWindowCenterPoint(string windowName) 9 | { 10 | return WindowUtils.GetWindowCenterPoint(windowName); 11 | } 12 | 13 | public uint GetProcessIdByWindowName(string windowName) 14 | { 15 | return WindowUtils.GetProcessIdByWindowName(windowName); 16 | } 17 | 18 | public string GetForegroundWindowName() 19 | { 20 | return WindowUtils.GetForegroundWindowName(); 21 | } 22 | } -------------------------------------------------------------------------------- /Phishy/Utils/AudioUtils.cs: -------------------------------------------------------------------------------- 1 | using NAudio.CoreAudioApi; 2 | 3 | 4 | namespace Phishy.Utils; 5 | 6 | internal class AudioUtils 7 | { 8 | public static float GetMasterVolumeLevel() 9 | { 10 | try 11 | { 12 | using var enumerator = new MMDeviceEnumerator(); 13 | using var device = enumerator.GetDefaultAudioEndpoint(DataFlow.Render, Role.Multimedia); 14 | float peakValue = device.AudioMeterInformation.MasterPeakValue; 15 | // Log every 10th call to avoid spam, or when value is significant 16 | if (Random.Shared.Next(10) == 0 || peakValue > 0.01f) 17 | { 18 | Console.WriteLine($"[AudioUtils]: Master peak value: {peakValue:F4}"); 19 | } 20 | return peakValue; 21 | } 22 | catch (Exception ex) 23 | { 24 | Console.WriteLine($"[AudioUtils]: Error getting master volume level: {ex.Message}"); 25 | return 0f; 26 | } 27 | } 28 | 29 | public static void SetVolumeToMax() 30 | { 31 | try 32 | { 33 | using var enumerator = new MMDeviceEnumerator(); 34 | using var device = enumerator.GetDefaultAudioEndpoint(DataFlow.Render, Role.Multimedia); 35 | 36 | float currentVolume = device.AudioEndpointVolume.MasterVolumeLevelScalar; 37 | Console.WriteLine($"[AudioUtils]: Current volume before setting: {currentVolume:F2}"); 38 | 39 | device.AudioEndpointVolume.MasterVolumeLevelScalar = 1.0f; 40 | 41 | float newVolume = device.AudioEndpointVolume.MasterVolumeLevelScalar; 42 | Console.WriteLine($"[AudioUtils]: Volume after setting to max: {newVolume:F2}"); 43 | 44 | if (Math.Abs(newVolume - 1.0f) > 0.01f) 45 | { 46 | Console.WriteLine($"[AudioUtils]: WARNING - Failed to set volume to max! Current: {newVolume:F2}"); 47 | } 48 | } 49 | catch (Exception ex) 50 | { 51 | Console.WriteLine($"[AudioUtils]: Error setting volume to max: {ex.Message}"); 52 | } 53 | } 54 | 55 | public static void MuteSound() 56 | { 57 | try 58 | { 59 | using var enumerator = new MMDeviceEnumerator(); 60 | using var device = enumerator.GetDefaultAudioEndpoint(DataFlow.Render, Role.Multimedia); 61 | 62 | bool wasMuted = device.AudioEndpointVolume.Mute; 63 | Console.WriteLine($"[AudioUtils]: Mute status before: {wasMuted}"); 64 | 65 | device.AudioEndpointVolume.Mute = true; 66 | 67 | bool isMuted = device.AudioEndpointVolume.Mute; 68 | Console.WriteLine($"[AudioUtils]: Mute status after: {isMuted}"); 69 | 70 | if (!isMuted) 71 | { 72 | Console.WriteLine("[AudioUtils]: WARNING - Failed to mute audio!"); 73 | } 74 | } 75 | catch (Exception ex) 76 | { 77 | Console.WriteLine($"[AudioUtils]: Error muting sound: {ex.Message}"); 78 | } 79 | } 80 | 81 | public static void LogAudioDeviceInfo() 82 | { 83 | try 84 | { 85 | using var enumerator = new MMDeviceEnumerator(); 86 | using var device = enumerator.GetDefaultAudioEndpoint(DataFlow.Render, Role.Multimedia); 87 | 88 | Console.WriteLine("[AudioUtils]: === Audio Device Diagnostic Info ==="); 89 | Console.WriteLine($"[AudioUtils]: Device Name: {device.FriendlyName}"); 90 | Console.WriteLine($"[AudioUtils]: Device State: {device.State}"); 91 | Console.WriteLine($"[AudioUtils]: Device ID: {device.ID}"); 92 | 93 | var volume = device.AudioEndpointVolume; 94 | Console.WriteLine($"[AudioUtils]: Volume Range: {volume.VolumeRange.MinDecibels}dB to {volume.VolumeRange.MaxDecibels}dB"); 95 | Console.WriteLine($"[AudioUtils]: Current Volume (Scalar): {volume.MasterVolumeLevelScalar:F2}"); 96 | Console.WriteLine($"[AudioUtils]: Current Volume (dB): {volume.MasterVolumeLevel:F2}dB"); 97 | Console.WriteLine($"[AudioUtils]: Is Muted: {volume.Mute}"); 98 | 99 | // Check if audio meter is working 100 | var meter = device.AudioMeterInformation; 101 | Console.WriteLine($"[AudioUtils]: Current Peak Value: {meter.MasterPeakValue:F4}"); 102 | 103 | // Check each channel 104 | int channelCount = meter.PeakValues.Count; 105 | Console.WriteLine($"[AudioUtils]: Number of channels: {channelCount}"); 106 | for (int i = 0; i < channelCount; i++) 107 | { 108 | Console.WriteLine($"[AudioUtils]: Channel {i} peak: {meter.PeakValues[i]:F4}"); 109 | } 110 | Console.WriteLine("[AudioUtils]: ==================================="); 111 | } 112 | catch (Exception ex) 113 | { 114 | Console.WriteLine($"[AudioUtils]: Error getting audio device info: {ex.Message}"); 115 | Console.WriteLine($"[AudioUtils]: Stack trace: {ex.StackTrace}"); 116 | } 117 | } 118 | 119 | public static void TestAudioDetection(int durationSeconds = 10) 120 | { 121 | Console.WriteLine($"[AudioUtils]: Starting audio detection test for {durationSeconds} seconds..."); 122 | Console.WriteLine("[AudioUtils]: Make some noise to test detection!"); 123 | 124 | try 125 | { 126 | LogAudioDeviceInfo(); 127 | 128 | DateTime startTime = DateTime.Now; 129 | float maxDetected = 0f; 130 | int detectionCount = 0; 131 | 132 | while ((DateTime.Now - startTime).TotalSeconds < durationSeconds) 133 | { 134 | float level = GetMasterVolumeLevel(); 135 | if (level > 0.001f) 136 | { 137 | detectionCount++; 138 | if (level > maxDetected) 139 | { 140 | maxDetected = level; 141 | } 142 | Console.WriteLine($"[AudioUtils]: Sound detected! Level: {level:F4}"); 143 | } 144 | 145 | Thread.Sleep(50); // Check 20 times per second 146 | } 147 | 148 | Console.WriteLine($"[AudioUtils]: Test complete. Max level: {maxDetected:F4}, Detections: {detectionCount}"); 149 | 150 | if (maxDetected == 0f) 151 | { 152 | Console.WriteLine("[AudioUtils]: WARNING - No audio was detected during the test!"); 153 | Console.WriteLine("[AudioUtils]: Possible causes:"); 154 | Console.WriteLine("[AudioUtils]: 1. Audio service not accessible from WSL"); 155 | Console.WriteLine("[AudioUtils]: 2. No audio playing or microphone input"); 156 | Console.WriteLine("[AudioUtils]: 3. Audio device is muted at hardware level"); 157 | Console.WriteLine("[AudioUtils]: 4. COM interop issues in WSL environment"); 158 | } 159 | } 160 | catch (Exception ex) 161 | { 162 | Console.WriteLine($"[AudioUtils]: Test failed with error: {ex.Message}"); 163 | } 164 | } 165 | } -------------------------------------------------------------------------------- /Phishy/Utils/FileUtils.cs: -------------------------------------------------------------------------------- 1 | namespace Phishy.Utils 2 | { 3 | internal class FileUtils 4 | { 5 | public static bool FileExistsInCurrentDirectory(string fileName) 6 | { 7 | string currentDirectory = Directory.GetCurrentDirectory(); 8 | string filePath = Path.Combine(currentDirectory, fileName); 9 | 10 | return File.Exists(filePath); 11 | } 12 | 13 | public static void SaveFileInCurrentDirectory(string fileName, string yaml) 14 | { 15 | string currentDirectory = Directory.GetCurrentDirectory(); 16 | string filePath = Path.Combine(currentDirectory, fileName); 17 | 18 | File.WriteAllText(filePath, yaml); 19 | } 20 | 21 | public static string ReadFileFromCurrentDirectory(string fileName) 22 | { 23 | string currentDirectory = Directory.GetCurrentDirectory(); 24 | string filePath = Path.Combine(currentDirectory, fileName); 25 | 26 | return File.ReadAllText(filePath); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Phishy/Utils/KeyboardUtils.cs: -------------------------------------------------------------------------------- 1 | namespace Phishy.Utils; 2 | 3 | internal class KeyboardUtils 4 | { 5 | public static void SendKeyInput(Keys key) 6 | { 7 | string keyString = ConvertToString(key); 8 | SendKeyInput(keyString); 9 | } 10 | 11 | public static void SendKeyInput(string key) 12 | { 13 | // For single letter keys, send without braces to get lowercase 14 | // For special keys (like numbers converted from Keys.D1), use braces 15 | if (key.Length == 1 && char.IsLetter(key[0])) 16 | { 17 | SendKeys.SendWait(key.ToLower()); 18 | } 19 | else 20 | { 21 | SendKeys.SendWait("{" + key + "}"); 22 | } 23 | } 24 | 25 | public static string ConvertToString(Keys key) 26 | { 27 | string keyString = key.ToString(); 28 | if (key is >= Keys.D0 and <= Keys.D9) 29 | { 30 | // For digits ('0' to '9'), convert the character to a string 31 | keyString = keyString[1..]; 32 | } 33 | return keyString; 34 | } 35 | } -------------------------------------------------------------------------------- /Phishy/Utils/MouseUtils.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | 3 | namespace Phishy.Utils; 4 | 5 | internal class MouseUtils 6 | { 7 | private const int INPUT_MOUSE = 0; 8 | private const int MOUSEEVENTF_RIGHTDOWN = 0x0008; 9 | private const int MOUSEEVENTF_RIGHTUP = 0x0010; 10 | private const int MOUSEEVENTF_LEFTDOWN = 0x0002; 11 | private const int MOUSEEVENTF_LEFTUP = 0x0004; 12 | 13 | [DllImport("user32.dll")] 14 | private static extern uint SendInput(uint nInputs, INPUT[] pInputs, int cbSize); 15 | 16 | [DllImport("user32.dll")] 17 | public static extern bool SetCursorPos(int x, int y); 18 | 19 | [DllImport("user32.dll")] 20 | static extern bool GetCursorPos(out Point lpPoint); 21 | 22 | public static void SendMouseInput(MouseButtons button) 23 | { 24 | INPUT mouseInput = new INPUT 25 | { 26 | Type = INPUT_MOUSE 27 | }; 28 | 29 | uint pressedFlags; 30 | uint releaseFlags; 31 | 32 | switch (button) 33 | { 34 | case MouseButtons.Left: 35 | pressedFlags = MOUSEEVENTF_LEFTDOWN; 36 | releaseFlags = MOUSEEVENTF_LEFTUP; 37 | break; 38 | case MouseButtons.Right: 39 | pressedFlags = MOUSEEVENTF_RIGHTDOWN; 40 | releaseFlags = MOUSEEVENTF_RIGHTUP; 41 | break; 42 | default: 43 | throw new ArgumentOutOfRangeException(nameof(button), button, null); 44 | } 45 | 46 | mouseInput.Data.Mouse.Flags = pressedFlags; 47 | SendInput(1, new[] { mouseInput }, INPUT.Size); 48 | 49 | Thread.Sleep(50); // adjust as needed 50 | 51 | mouseInput.Data.Mouse.Flags = releaseFlags; 52 | SendInput(1, new[] { mouseInput }, INPUT.Size); 53 | } 54 | 55 | private static void MoveCursor(Point targetPoint) 56 | { 57 | SetCursorPos(targetPoint.X, targetPoint.Y); 58 | } 59 | 60 | private static void MoveCursor(Point targetPoint, bool smoothly) 61 | { 62 | if (smoothly) 63 | { 64 | GetCursorPos(out var cursorPosition); 65 | int startX = cursorPosition.X; 66 | int startY = cursorPosition.Y; 67 | int targetX = targetPoint.X; 68 | int targetY = targetPoint.Y; 69 | const int steps = 100; 70 | const int delay = 10; 71 | 72 | for (int i = 0; i <= steps; i++) 73 | { 74 | double t = (double)i / steps; 75 | int x = Interpolate(startX, targetX, t); 76 | int y = Interpolate(startY, targetY, t); 77 | 78 | MoveCursor(new Point { X = x, Y = y }); 79 | 80 | Thread.Sleep(delay); 81 | } 82 | } 83 | else 84 | { 85 | MoveCursor(targetPoint); 86 | } 87 | } 88 | 89 | private static int Interpolate(int start, int target, double t) 90 | { 91 | return (int)Math.Round(start + (target - start) * t); 92 | } 93 | 94 | public static void MoveToCenterOfWindow(string windowName, bool smoothly, int heightCorrectionPixels) 95 | { 96 | string foregroundWindowName = WindowUtils.GetForegroundWindowName(); 97 | if (foregroundWindowName != windowName) 98 | { 99 | Console.WriteLine($"[MouseUtils]: Foreground window name is {foregroundWindowName} and not {windowName}, not moving mouse."); 100 | return; 101 | } 102 | 103 | Point centerPoint = WindowUtils.GetWindowCenterPoint(windowName)!.Value; 104 | centerPoint.Y -= heightCorrectionPixels; 105 | 106 | MoveCursor(centerPoint, smoothly); 107 | } 108 | public static void MoveMouseFibonacci(CancellationToken cancellationToken, string windowName, Func isBobberFound) 109 | { 110 | GetCursorPos(out var startingPoint); 111 | 112 | // Radius and angular speed for the spiral 113 | double radius = 1.0; 114 | double angle = 0.1; 115 | const double angularSpeed = 0.1; 116 | const double radiusMod = 0.05; 117 | 118 | // Calculate the number of iterations for the spiral 119 | const int iterations = 600; 120 | 121 | for (int i = 0; i < iterations; i++) 122 | { 123 | if (cancellationToken.IsCancellationRequested || isBobberFound()) 124 | { 125 | break; 126 | } 127 | 128 | angle += angularSpeed; 129 | radius += radiusMod; 130 | 131 | startingPoint.X += (int)(radius * Math.Cos(angle)); 132 | startingPoint.Y += (int)(radius * Math.Sin(angle)); 133 | 134 | SetCursorPos(startingPoint.X, startingPoint.Y); 135 | Thread.Sleep(10); 136 | } 137 | } 138 | 139 | #region structs 140 | [StructLayout(LayoutKind.Sequential)] 141 | private struct INPUT 142 | { 143 | public uint Type; 144 | public MOUSEKEYBDHARDWAREINPUT Data; 145 | public static int Size => Marshal.SizeOf(typeof(INPUT)); 146 | } 147 | 148 | [StructLayout(LayoutKind.Explicit)] 149 | private struct MOUSEKEYBDHARDWAREINPUT 150 | { 151 | [FieldOffset(0)] 152 | public MOUSEINPUT Mouse; 153 | [FieldOffset(0)] 154 | public KEYBDINPUT Keyboard; 155 | [FieldOffset(0)] 156 | public HARDWAREINPUT Hardware; 157 | } 158 | 159 | [StructLayout(LayoutKind.Sequential)] 160 | private struct MOUSEINPUT 161 | { 162 | public int X; 163 | public int Y; 164 | public uint MouseData; 165 | public uint Flags; 166 | public uint Time; 167 | public IntPtr ExtraInfo; 168 | } 169 | 170 | [StructLayout(LayoutKind.Sequential)] 171 | private struct KEYBDINPUT 172 | { 173 | public ushort KeyCode; 174 | public ushort Scan; 175 | public uint Flags; 176 | public uint Time; 177 | public IntPtr ExtraInfo; 178 | } 179 | 180 | [StructLayout(LayoutKind.Sequential)] 181 | public struct HARDWAREINPUT 182 | { 183 | public uint Msg; 184 | public ushort ParamL; 185 | public ushort ParamH; 186 | } 187 | #endregion 188 | } -------------------------------------------------------------------------------- /Phishy/Utils/WindowUtils.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | using System.Text; 3 | 4 | namespace Phishy.Utils; 5 | 6 | internal class WindowUtils 7 | { 8 | [DllImport("user32.dll", SetLastError = true)] 9 | private static extern IntPtr FindWindow(string? lpClassName, string lpWindowName); 10 | 11 | [DllImport("user32.dll", SetLastError = true)] 12 | private static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint lpdwProcessId); 13 | 14 | [DllImport("user32.dll", SetLastError = true)] 15 | private static extern bool GetClientRect(IntPtr hWnd, out RECT lpRect); 16 | 17 | [DllImport("user32.dll", SetLastError = true)] 18 | private static extern bool ClientToScreen(IntPtr hWnd, ref Point lpPoint); 19 | 20 | [DllImport("user32.dll", SetLastError = true)] 21 | private static extern IntPtr GetForegroundWindow(); 22 | 23 | [DllImport("user32.dll", CharSet = CharSet.Unicode, SetLastError = true)] 24 | private static extern int GetWindowText(IntPtr hWnd, StringBuilder lpWindowText, int nMaxCount); 25 | 26 | public static Point? GetWindowCenterPoint(string windowName) 27 | { 28 | IntPtr windowHandle = FindWindow(null, windowName); 29 | if (windowHandle == IntPtr.Zero) 30 | { 31 | int win32Error = Marshal.GetLastWin32Error(); 32 | Console.WriteLine($"[WindowUtils]: Failed retrieving window handle for '{windowName}'. Error: {win32Error}"); 33 | return null; 34 | } 35 | 36 | if (GetClientRect(windowHandle, out var clientRect)) 37 | { 38 | Point centerPoint = default; 39 | centerPoint.X = (clientRect.Left + clientRect.Right) / 2; 40 | centerPoint.Y = (clientRect.Top + clientRect.Bottom) / 2; 41 | 42 | if (!ClientToScreen(windowHandle, ref centerPoint)) 43 | { 44 | int clientToScreenError = Marshal.GetLastWin32Error(); 45 | Console.WriteLine($"[WindowUtils]: Failed ClientToScreen. Error: {clientToScreenError}"); 46 | return null; 47 | } 48 | 49 | return centerPoint; 50 | } 51 | 52 | int getClientRectError = Marshal.GetLastWin32Error(); 53 | Console.WriteLine($"[WindowUtils]: Failed GetClientRect. Error: {getClientRectError}"); 54 | return null; 55 | } 56 | 57 | public static uint GetProcessIdByWindowName(string windowName) 58 | { 59 | IntPtr windowHandle = FindWindow(null, windowName); 60 | if (windowHandle == IntPtr.Zero) 61 | { 62 | int error = Marshal.GetLastWin32Error(); 63 | Console.WriteLine($"[WindowUtils]: Failed retrieving window handle for '{windowName}'. Error: {error}"); 64 | return 0; 65 | } 66 | 67 | uint threadId = GetWindowThreadProcessId(windowHandle, out uint processId); 68 | if (threadId == 0) 69 | { 70 | int error = Marshal.GetLastWin32Error(); 71 | Console.WriteLine($"[WindowUtils]: Failed GetWindowThreadProcessId. Error: {error}"); 72 | return 0; 73 | } 74 | 75 | return processId; 76 | } 77 | 78 | public static string GetForegroundWindowName() 79 | { 80 | IntPtr foregroundWindowHandle = GetForegroundWindow(); 81 | if (foregroundWindowHandle == IntPtr.Zero) 82 | { 83 | int error = Marshal.GetLastWin32Error(); 84 | Console.WriteLine($"[WindowUtils]: Failed GetForegroundWindow. Error: {error}"); 85 | return string.Empty; 86 | } 87 | return GetWindowTitle(foregroundWindowHandle); 88 | } 89 | 90 | private static string GetWindowTitle(IntPtr windowHandle) 91 | { 92 | const int maxWindowTitleLength = 256; 93 | StringBuilder windowTitleBuilder = new StringBuilder(maxWindowTitleLength); 94 | int length = GetWindowText(windowHandle, windowTitleBuilder, maxWindowTitleLength); 95 | 96 | if (length == 0) 97 | { 98 | int error = Marshal.GetLastWin32Error(); 99 | if (error != 0) // 0 means no error, just empty title 100 | { 101 | Console.WriteLine($"[WindowUtils]: Failed GetWindowText. Error: {error}"); 102 | } 103 | return string.Empty; 104 | } 105 | 106 | return windowTitleBuilder.ToString(0, length); 107 | } 108 | 109 | #region structs 110 | 111 | public struct RECT 112 | { 113 | public int Left; 114 | public int Top; 115 | public int Right; 116 | public int Bottom; 117 | } 118 | 119 | #endregion 120 | } -------------------------------------------------------------------------------- /Phishy/Utils/YamlUtils.cs: -------------------------------------------------------------------------------- 1 | using Phishy.Configs; 2 | using YamlDotNet.Serialization; 3 | using YamlDotNet.Serialization.NamingConventions; 4 | 5 | namespace Phishy.Utils 6 | { 7 | public class YamlUtils 8 | { 9 | public static void GenerateSampleRunConfig(string fileName) 10 | { 11 | Properties properties = new(); 12 | 13 | ISerializer serializer = new SerializerBuilder() 14 | .WithNamingConvention(HyphenatedNamingConvention.Instance) 15 | .Build(); 16 | string yaml = serializer.Serialize(properties); 17 | 18 | FileUtils.SaveFileInCurrentDirectory(fileName, yaml); 19 | 20 | Console.WriteLine($"[YamlUtils]: Generated sample YAML config with name: {fileName}."); 21 | } 22 | 23 | public static Properties? ReadPropertiesFromCurrentDirectory(string fileName) 24 | { 25 | string yamlContent = FileUtils.ReadFileFromCurrentDirectory(fileName); 26 | 27 | IDeserializer deserializer = new DeserializerBuilder() 28 | .WithDuplicateKeyChecking() 29 | .WithNamingConvention(HyphenatedNamingConvention.Instance) 30 | .Build(); 31 | 32 | try 33 | { 34 | return deserializer.Deserialize(yamlContent); 35 | } 36 | catch (FileNotFoundException) 37 | { 38 | Console.WriteLine($"[YamlUtils]: The file '{fileName}' does not exist."); 39 | } 40 | catch (YamlDotNet.Core.YamlException ex) 41 | { 42 | string errorMsg = ex.Message; 43 | string errorToMatch = " not found"; 44 | if (errorMsg.Contains(errorToMatch)) 45 | { 46 | var index = errorMsg.IndexOf(errorToMatch, StringComparison.Ordinal); 47 | errorMsg = errorMsg.Substring(0, index) + " is invalid!"; 48 | } 49 | Console.WriteLine($"[YamlUtils]: Error while deserializing YAML: {errorMsg}"); 50 | } 51 | catch (Exception ex) 52 | { 53 | Console.WriteLine($"[YamlUtils]: An error occurred: {ex.Message}"); 54 | } 55 | 56 | return null; 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 |

Phishy

3 | 4 |

5 | 6 | Latest Release 7 | 8 | 9 | Downloads 10 | 11 | 12 | License 13 | 14 |

15 | 16 |

17 | ⚠️ USE AT YOUR OWN RISK ⚠️ 18 |

19 | 20 |

21 | An advanced out-of-process fishing automation tool for World of Warcraft using Windows API hooks 22 |
23 |
24 | Features 25 | · 26 | How It Works 27 | · 28 | Getting Started 29 | · 30 | Configuration 31 |
32 |
33 | Report Bug 34 | · 35 | Request Feature 36 | · 37 | Original C++ PoC 38 |

39 |
40 | 41 | ## ⚠️ Disclaimer 42 | 43 | This tool is for educational purposes only. Using automation tools may violate the Terms of Service of World of Warcraft and could result in account suspension or ban. The authors are not responsible for any consequences of using this software. 44 | 45 | ## 📖 Table of Contents 46 | 47 | - [Features](#features) 48 | - [How It Works](#how-it-works) 49 | - [Requirements](#requirements) 50 | - [Getting Started](#getting-started) 51 | - [Installation](#installation) 52 | - [Building from Source](#building-from-source) 53 | - [Configuration](#configuration) 54 | - [Usage](#usage) 55 | - [Troubleshooting](#troubleshooting) 56 | - [Architecture](#architecture) 57 | - [Contributing](#contributing) 58 | - [License](#license) 59 | 60 | ## ✨ Features 61 | 62 | - **Out-of-process operation** - Uses Windows API hooks without injecting into the game 63 | - **Universal compatibility** - Works with any WoW version (Classic, TBC, WotLK, Retail) 64 | - **Audio-based detection** - Detects fish by monitoring Windows master volume 65 | - **Cursor change detection** - Identifies bobber location via cursor icon changes 66 | - **Automatic lure application** - Supports up to two different lures with configurable timers 67 | - **Wintergrasp support** - Automatically logs out during Wintergrasp battles (WotLK) 68 | - **State machine architecture** - Predictable and debuggable behavior 69 | - **Configuration validation** - Clear error messages for misconfigured settings 70 | - **Resource efficient** - Minimal CPU usage with optimized polling 71 | 72 | ## 🔧 How It Works 73 | 74 | Phishy uses a clever combination of Windows APIs to automate fishing without reading or modifying game memory: 75 | 76 | 1. **The Eyes** 👁️ - Monitors cursor icon changes (`EVENT_OBJECT_NAMECHANGE`) to detect when hovering over the fishing bobber 77 | 2. **The Ears** 👂 - Listens for volume spikes in Windows master audio to detect fish splashing 78 | 3. **The Brain** 🧠 - State machine that coordinates the fishing process 79 | 4. **The Hands** ✋ - Simulates mouse clicks and keyboard inputs to catch fish 80 | 81 | ### State Machine Flow 82 | 83 | ``` 84 | Start → Apply Lure (optional) → Cast Line → Find Bobber → Wait for Fish → Catch Fish → Repeat 85 | ↓ 86 | Logout (Wintergrasp) → Wait → Login 87 | ``` 88 | 89 | ## 💻 Requirements 90 | 91 | - **Operating System**: Windows 10/11 (Windows-specific APIs) 92 | - **.NET Runtime**: .NET 9.0 Desktop Runtime 93 | - **Development** (if building from source): 94 | - Visual Studio 2022 with .NET Desktop workload 95 | - .NET 9.0 SDK 96 | 97 | ## 🚀 Getting Started 98 | 99 | ### Installation 100 | 101 | 1. **Download the appropriate version for your system:** 102 | - **For most users:** Download the latest Windows 64-bit version from the [Releases page](https://github.com/stdNullPtr/Phishy/releases/latest) 103 | - **For 32-bit systems:** Download the Windows x86 version from the [Releases page](https://github.com/stdNullPtr/Phishy/releases/latest) 104 | 105 | > Not sure which version to choose? If you're running Windows 10/11, choose the 64-bit version. 106 | 107 | 2. Extract the ZIP file to a folder of your choice 108 | 3. Run `guess.exe` (intentionally generic name) 109 | 4. On first run, a `configuration.yaml` file will be created and opened in Notepad 110 | 5. Configure the settings according to your WoW setup (see [Configuration](#configuration)) 111 | 6. Run `guess.exe` again to start fishing 112 | 113 | ### Building from Source 114 | 115 | 1. Clone the repository: 116 | ```bash 117 | git clone https://github.com/stdNullPtr/Phishy.git 118 | cd Phishy 119 | ``` 120 | 121 | 2. Open `Phishy.sln` in Visual Studio 2022 122 | 123 | 3. Build the solution (Ctrl+Shift+B) in Release mode 124 | 125 | 4. Find the executable at: `Phishy\bin\Release\net9.0-windows\guess.exe` 126 | 127 | Alternatively, using the command line: 128 | ```bash 129 | dotnet build -c Release 130 | ``` 131 | 132 | ## ⚙️ Configuration 133 | 134 | The bot uses a YAML configuration file (`configuration.yaml`) with the following options: 135 | 136 | ```yaml 137 | # Window Configuration 138 | game-window-name: World of Warcraft # Must match your WoW window title exactly 139 | 140 | # Keybinds (use lowercase letters) 141 | keyboard-key-start-fishing: 1 # Key bound to fishing ability 142 | keyboard-key-apply-lure: 2 # Key bound to first lure (optional) 143 | keyboard-key-apply-second-lure: 3 # Key bound to second lure (optional) 144 | keyboard-key-logout: l # Key bound to /logout macro (for Wintergrasp) 145 | 146 | # Lure Settings 147 | lure-buff-duration-minutes: 10 # Duration of first lure buff 148 | second-lure-buff-duration-minutes: 5 # Duration of second lure buff (optional) 149 | 150 | # Fishing Settings 151 | fishing-channel-duration-seconds: 21 # How long to wait for a fish (default: 21) 152 | 153 | # Audio Settings 154 | setup-sound: true # Auto-configure Windows volume settings 155 | 156 | # Wintergrasp Settings (WotLK only) 157 | wait-for-wintergrasp: false # Enable Wintergrasp logout/login cycle 158 | ``` 159 | 160 | ### Configuration Tips 161 | 162 | - **Window Name**: Must match exactly (case-sensitive). Common values: 163 | - `World of Warcraft` (Retail/Classic) 164 | - `World of Warcraft Classic` 165 | - Custom names if you've renamed your window 166 | 167 | - **Keybinds**: Use single lowercase letters or numbers that match your in-game keybinds 168 | 169 | - **Lure Duration**: Set slightly lower than actual buff duration to ensure reapplication 170 | 171 | - **Channel Duration**: Default is 21 seconds, increase if you have fishing skill bonuses 172 | 173 | ## 📋 Usage 174 | 175 | ### Initial Setup 176 | 177 | 1. **In-game preparation**: 178 | - Bind your fishing ability to key `1` (or configure differently) 179 | - Bind your lure(s) to keys `2` and `3` (optional) 180 | - Create a `/logout` macro and bind it (for Wintergrasp feature) 181 | - Position yourself at a fishing spot 182 | - Zoom in completely (first-person view works best) 183 | - Set game sound to ~80%, disable ambient sounds 184 | 185 | 2. **Windows preparation**: 186 | - The bot will automatically set Windows volume to maximum and mute it 187 | - Ensure no other applications are making sounds 188 | 189 | 3. **Running the bot**: 190 | - Start `guess.exe` 191 | - Focus the WoW window 192 | - The bot will begin fishing automatically 193 | - Press `DELETE` key to stop 194 | 195 | ### Best Practices 196 | 197 | - Test manual fishing first to ensure bobber lands near screen center 198 | - Fish in quiet areas to avoid sound interference 199 | - Keep the WoW window in focus and don't minimize it 200 | - Don't move the mouse while the bot is running 201 | 202 | ## 🔍 Troubleshooting 203 | 204 | ### Common Issues 205 | 206 | **"Failed retrieving window handle"** 207 | - Ensure the window name in config matches exactly 208 | - WoW must be running before starting the bot 209 | 210 | **Bot doesn't detect bobber** 211 | - Zoom in completely 212 | - Ensure bobber lands near screen center 213 | - Try adjusting camera angle 214 | - Check that cursor changes to "interact" icon over bobber 215 | 216 | **Bot doesn't catch fish** 217 | - Increase game sound volume 218 | - Disable all ambient sounds 219 | - Ensure Windows volume is not muted by other apps 220 | - Fish in quieter areas 221 | 222 | **Configuration validation errors** 223 | - Check the error message for specific issues 224 | - Ensure all required fields are filled 225 | - Verify keybinds are single characters 226 | 227 | ### Debug Mode 228 | 229 | Run from Visual Studio in Debug mode to see detailed logging output. 230 | 231 | ## 🏗️ Architecture 232 | 233 | The project follows SOLID principles with recent architectural improvements: 234 | 235 | ### Core Components 236 | 237 | - **State Machine** (`FishingStateMachine.cs`) - Manages fishing states and transitions 238 | - **Hooks** - Windows API hooks for input/output: 239 | - `WinEventHook` - Cursor change detection 240 | - `MouseHook` - Mouse input monitoring 241 | - `KeyboardHook` - Keyboard input monitoring 242 | - **Services** - Business logic implementations: 243 | - `AudioDetector` - Sound detection 244 | - `WindowManager` - Window operations 245 | - `InputSimulator` - Input simulation 246 | - `ConsoleLogger` - Logging 247 | - **Utils** - Low-level Windows API wrappers 248 | - **Interfaces** - Contracts for dependency injection 249 | 250 | ### Recent Improvements 251 | 252 | - Thread-safe operations with proper locking 253 | - Comprehensive error handling with Win32 error codes 254 | - Resource disposal for COM objects 255 | - Configuration validation 256 | - Reduced CPU usage by 80% 257 | - Clean architecture with interfaces 258 | 259 | ## 🤝 Contributing 260 | 261 | Contributions are welcome! Please follow these steps: 262 | 263 | 1. Fork the repository 264 | 2. Create a feature branch (`git checkout -b feature/AmazingFeature`) 265 | 3. Commit your changes (`git commit -m 'feat: add amazing feature'`) 266 | 4. Push to the branch (`git push origin feature/AmazingFeature`) 267 | 5. Open a Pull Request 268 | 269 | Please ensure your code follows the existing patterns and includes appropriate error handling. 270 | 271 | ## 📜 License 272 | 273 | This project is licensed under the **GNU Affero General Public License v3.0 (AGPL-3.0)** - see the [LICENSE](LICENSE) file for details. 274 | 275 | ### What this means: 276 | - ✅ **Free to use, modify, and distribute** 277 | - ✅ **Commercial use is allowed** 278 | - ✅ **All derivatives MUST be open source** 279 | - ✅ **Network use requires source disclosure** 280 | - ⚠️ **Strong copyleft - changes must use AGPL-3.0** 281 | 282 | The AGPL ensures that all modifications and derivatives remain open source, even when used as a network service. If you modify this code and provide it as a service, you must share your source code. 283 | 284 | ## 🙏 Acknowledgments 285 | 286 | - Original C++ proof-of-concept: [wow-fishbot](https://github.com/stdNullPtr/wow-fishbot) 287 | - Windows API documentation and community 288 | - NAudio library for audio processing 289 | 290 | --- 291 | 292 |
293 | Made with ❤️ by stdNullPtr 294 |
-------------------------------------------------------------------------------- /images/.net-desktop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stdNullPtr/Phishy/83ba7b44504e3e5bbeb155b19917d7bac944c2cd/images/.net-desktop.png -------------------------------------------------------------------------------- /images/first-launch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stdNullPtr/Phishy/83ba7b44504e3e5bbeb155b19917d7bac944c2cd/images/first-launch.png -------------------------------------------------------------------------------- /images/startup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stdNullPtr/Phishy/83ba7b44504e3e5bbeb155b19917d7bac944c2cd/images/startup.png -------------------------------------------------------------------------------- /release-please-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "packages": { 3 | ".": { 4 | "release-type": "simple", 5 | "package-name": "phishy", 6 | "changelog-path": "CHANGELOG.md", 7 | "bump-minor-pre-major": false, 8 | "bump-patch-for-minor-pre-major": false, 9 | "draft": false, 10 | "prerelease": false 11 | } 12 | }, 13 | "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json" 14 | } -------------------------------------------------------------------------------- /version.txt: -------------------------------------------------------------------------------- 1 | 1.1.0 2 | --------------------------------------------------------------------------------