├── .gitattributes ├── .github └── workflows │ └── async_project_files.yml ├── .gitignore ├── BiliAccount.Core31TestProject ├── BiliAccount.Core31TestProject.csproj └── Program.cs ├── BiliAccount.Geetest.Controls ├── BiliAccount.Geetest.Controls.csproj ├── Properties │ ├── Resources.Designer.cs │ ├── Resources.resx │ └── launchSettings.json ├── WPF │ ├── GeetestBrowser.xaml │ ├── GeetestBrowser.xaml.cs │ ├── GeetestBrowserWindow.xaml │ └── GeetestBrowserWindow.xaml.cs ├── Winforms │ ├── GeetestBrowser.Designer.cs │ ├── GeetestBrowser.cs │ ├── GeetestBrowser.resx │ ├── GeetestBrowserWindow.Designer.cs │ ├── GeetestBrowserWindow.cs │ └── GeetestBrowserWindow.resx ├── favicon_4.ico └── favicon_4.png ├── BiliAccount.Geetest ├── BiliAccount.Geetest.csproj ├── Geetest.cs ├── Proxy.cs └── favicon_4.png ├── BiliAccount.TestProject.WPF ├── App.config ├── App.xaml ├── App.xaml.cs ├── BiliAccount.TestProject.WPF.csproj ├── MainWindow.xaml ├── MainWindow.xaml.cs └── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── BiliAccount.TestProject.Winforms ├── App.config ├── BiliAccount.TestProject.Winforms.csproj ├── Form1.Designer.cs ├── Form1.cs ├── Form1.resx ├── Program.cs └── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── BiliAccount.TestProject ├── App.config ├── BiliAccount.TestProject.csproj ├── Program.cs └── Properties │ └── AssemblyInfo.cs ├── BiliAccount.sln ├── BiliAccount ├── Account.cs ├── BiliAccount.csproj ├── Core │ ├── ByPassword.cs │ ├── ByQRCode.cs │ ├── BySMS.cs │ ├── Config.cs │ └── Device_Verify.cs ├── Exceptions │ ├── GetAccount_Exception.cs │ ├── InvalidColorValue.cs │ ├── Revoke_Exception.cs │ ├── SMS_NeedGeetest_Exception.cs │ ├── SMS_Send_Exception.cs │ └── Verify_Exception.cs ├── Framework4.0Methods │ ├── Stream4Methods.cs │ └── String4Methods.cs ├── Http.cs ├── Init.json ├── Linq │ ├── ByPassword.cs │ ├── ByQRCode.cs │ ├── BySMS.cs │ └── Device_Verify.cs ├── Properties │ └── launchSettings.json ├── QRCode │ ├── AbstractQRCode.cs │ ├── PayloadGenerator.cs │ ├── QRCode.cs │ ├── QRCodeData.cs │ └── QRCodeGenerator.cs ├── RSA.cs └── favicon_4.png ├── LICENSE └── README.md /.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/workflows/async_project_files.yml: -------------------------------------------------------------------------------- 1 | # This is a basic workflow to help you get started with Actions 2 | 3 | name: async_project_files 4 | 5 | # Controls when the action will run. Triggers the workflow on push or pull request 6 | # events but only for the master branch 7 | on: 8 | pull_request_target: 9 | types: [ closed ] 10 | branches: [ master ] 11 | 12 | # A workflow run is made up of one or more jobs that can run sequentially or in parallel 13 | jobs: 14 | # This workflow contains a single job called "build" 15 | async_project_files: 16 | #ignore Bump braches created by bot 17 | if: contains(github.head_ref, 'Bump') == false 18 | # The type of runner that the job will run on 19 | runs-on: ubuntu-latest 20 | 21 | env: 22 | username: 'LeoChen98' 23 | pwd: ${{ secrets.password }} 24 | msg: -m "async project file from main repository by bot ${{ github.sha }}" 25 | 26 | # Steps represent a sequence of tasks that will be executed as part of the job 27 | steps: 28 | ## Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it 29 | #- uses: actions/checkout@v2 30 | 31 | - name: checkout BiliAccount 32 | run: | 33 | #sudo apt-get install tree 34 | git config --global user.email "Leo@zhangbudademao.com" 35 | git config --global user.name "Leo Chen" 36 | mkdir 'BiliAccount' 37 | cd BiliAccount 38 | git init 39 | git clone -b master https://github.com/LeoChen98/BiliAccount.git 40 | cd .. 41 | 42 | # Runs a single command using the runners shell 43 | - name: async BiliAccount.Geetest 44 | run: | 45 | mkdir 'BiliAccount.Geetest' 46 | cd BiliAccount.Geetest 47 | git init 48 | git remote add origin https://$username:$pwd@github.com/LeoChen98/BiliAccount.Geetest.git 49 | git pull origin master 50 | cp -f ../BiliAccount/BiliAccount/BiliAccount.Geetest/BiliAccount.Geetest.csproj . 51 | #tree 52 | git add BiliAccount.Geetest.csproj 53 | git commit -m "async transfer project file from main repository by bot "${{ github.sha }} -n --allow-empty 54 | git push --set-upstream origin master 55 | cd .. 56 | 57 | # Runs a single command using the runners shell 58 | - name: async BiliAccount.Geetest.Controls 59 | run: | 60 | mkdir 'BiliAccount.Geetest.Controls' 61 | cd BiliAccount.Geetest.Controls 62 | git init 63 | git remote add origin https://$username:$pwd@github.com/LeoChen98/BiliAccount.Geetest.Controls.git 64 | git pull origin master 65 | cp -f ../BiliAccount/BiliAccount/BiliAccount.Geetest.Controls/BiliAccount.Geetest.Controls.csproj . 66 | #tree 67 | git add BiliAccount.Geetest.Controls.csproj 68 | git commit -m "async transfer project file from main repository by bot "${{ github.sha }} -n --allow-empty 69 | git push --set-upstream origin master 70 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | bld/ 21 | [Bb]in/ 22 | [Oo]bj/ 23 | [Ll]og/ 24 | 25 | # Visual Studio 2015 cache/options directory 26 | .vs/ 27 | # Uncomment if you have tasks that create the project's static files in wwwroot 28 | #wwwroot/ 29 | 30 | # MSTest test Results 31 | [Tt]est[Rr]esult*/ 32 | [Bb]uild[Ll]og.* 33 | 34 | # NUNIT 35 | *.VisualState.xml 36 | TestResult.xml 37 | 38 | # Build Results of an ATL Project 39 | [Dd]ebugPS/ 40 | [Rr]eleasePS/ 41 | dlldata.c 42 | 43 | # DNX 44 | project.lock.json 45 | project.fragment.lock.json 46 | artifacts/ 47 | 48 | *_i.c 49 | *_p.c 50 | *_i.h 51 | *.ilk 52 | *.meta 53 | *.obj 54 | *.pch 55 | *.pdb 56 | *.pgc 57 | *.pgd 58 | *.rsp 59 | *.sbr 60 | *.tlb 61 | *.tli 62 | *.tlh 63 | *.tmp 64 | *.tmp_proj 65 | *.log 66 | *.vspscc 67 | *.vssscc 68 | .builds 69 | *.pidb 70 | *.svclog 71 | *.scc 72 | 73 | # Chutzpah Test files 74 | _Chutzpah* 75 | 76 | # Visual C++ cache files 77 | ipch/ 78 | *.aps 79 | *.ncb 80 | *.opendb 81 | *.opensdf 82 | *.sdf 83 | *.cachefile 84 | *.VC.db 85 | *.VC.VC.opendb 86 | 87 | # Visual Studio profiler 88 | *.psess 89 | *.vsp 90 | *.vspx 91 | *.sap 92 | 93 | # TFS 2012 Local Workspace 94 | $tf/ 95 | 96 | # Guidance Automation Toolkit 97 | *.gpState 98 | 99 | # ReSharper is a .NET coding add-in 100 | _ReSharper*/ 101 | *.[Rr]e[Ss]harper 102 | *.DotSettings.user 103 | 104 | # JustCode is a .NET coding add-in 105 | .JustCode 106 | 107 | # TeamCity is a build add-in 108 | _TeamCity* 109 | 110 | # DotCover is a Code Coverage Tool 111 | *.dotCover 112 | 113 | # NCrunch 114 | _NCrunch_* 115 | .*crunch*.local.xml 116 | nCrunchTemp_* 117 | 118 | # MightyMoose 119 | *.mm.* 120 | AutoTest.Net/ 121 | 122 | # Web workbench (sass) 123 | .sass-cache/ 124 | 125 | # Installshield output folder 126 | [Ee]xpress/ 127 | 128 | # DocProject is a documentation generator add-in 129 | DocProject/buildhelp/ 130 | DocProject/Help/*.HxT 131 | DocProject/Help/*.HxC 132 | DocProject/Help/*.hhc 133 | DocProject/Help/*.hhk 134 | DocProject/Help/*.hhp 135 | DocProject/Help/Html2 136 | DocProject/Help/html 137 | 138 | # Click-Once directory 139 | publish/ 140 | 141 | # Publish Web Output 142 | *.[Pp]ublish.xml 143 | *.azurePubxml 144 | # TODO: Comment the next line if you want to checkin your web deploy settings 145 | # but database connection strings (with potential passwords) will be unencrypted 146 | #*.pubxml 147 | *.publishproj 148 | 149 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 150 | # checkin your Azure Web App publish settings, but sensitive information contained 151 | # in these scripts will be unencrypted 152 | PublishScripts/ 153 | 154 | # NuGet Packages 155 | *.nupkg 156 | # The packages folder can be ignored because of Package Restore 157 | **/packages/* 158 | # except build/, which is used as an MSBuild target. 159 | !**/packages/build/ 160 | # Uncomment if necessary however generally it will be regenerated when needed 161 | #!**/packages/repositories.config 162 | # NuGet v3's project.json files produces more ignoreable files 163 | *.nuget.props 164 | *.nuget.targets 165 | 166 | # Microsoft Azure Build Output 167 | csx/ 168 | *.build.csdef 169 | 170 | # Microsoft Azure Emulator 171 | ecf/ 172 | rcf/ 173 | 174 | # Windows Store app package directories and files 175 | AppPackages/ 176 | BundleArtifacts/ 177 | Package.StoreAssociation.xml 178 | _pkginfo.txt 179 | 180 | # Visual Studio cache files 181 | # files ending in .cache can be ignored 182 | *.[Cc]ache 183 | # but keep track of directories ending in .cache 184 | !*.[Cc]ache/ 185 | 186 | # Others 187 | ClientBin/ 188 | ~$* 189 | *~ 190 | *.dbmdl 191 | *.dbproj.schemaview 192 | *.jfm 193 | *.pfx 194 | *.publishsettings 195 | node_modules/ 196 | orleans.codegen.cs 197 | 198 | # Since there are multiple workflows, uncomment next line to ignore bower_components 199 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 200 | #bower_components/ 201 | 202 | # RIA/Silverlight projects 203 | Generated_Code/ 204 | 205 | # Backup & report files from converting an old project file 206 | # to a newer Visual Studio version. Backup files are not needed, 207 | # because we have git ;-) 208 | _UpgradeReport_Files/ 209 | Backup*/ 210 | UpgradeLog*.XML 211 | UpgradeLog*.htm 212 | 213 | # SQL Server files 214 | *.mdf 215 | *.ldf 216 | 217 | # Business Intelligence projects 218 | *.rdl.data 219 | *.bim.layout 220 | *.bim_*.settings 221 | 222 | # Microsoft Fakes 223 | FakesAssemblies/ 224 | 225 | # GhostDoc plugin setting file 226 | *.GhostDoc.xml 227 | 228 | # Node.js Tools for Visual Studio 229 | .ntvs_analysis.dat 230 | 231 | # Visual Studio 6 build log 232 | *.plg 233 | 234 | # Visual Studio 6 workspace options file 235 | *.opt 236 | 237 | # Visual Studio LightSwitch build output 238 | **/*.HTMLClient/GeneratedArtifacts 239 | **/*.DesktopClient/GeneratedArtifacts 240 | **/*.DesktopClient/ModelManifest.xml 241 | **/*.Server/GeneratedArtifacts 242 | **/*.Server/ModelManifest.xml 243 | _Pvt_Extensions 244 | 245 | # Paket dependency manager 246 | .paket/paket.exe 247 | paket-files/ 248 | 249 | # FAKE - F# Make 250 | .fake/ 251 | 252 | # JetBrains Rider 253 | .idea/ 254 | *.sln.iml 255 | 256 | # CodeRush 257 | .cr/ 258 | 259 | # Python Tools for Visual Studio (PTVS) 260 | __pycache__/ 261 | *.pyc 262 | 263 | # Nuget 264 | *.nuspec 265 | *.nupkg 266 | nuget.exe 267 | nuget_release.bat 268 | 269 | #Old files 270 | BiliAccount-StandardRebuild/ 271 | BiliAccount-backup/ 272 | BiliAccount.Geetest/Trace.cs -------------------------------------------------------------------------------- /BiliAccount.Core31TestProject/BiliAccount.Core31TestProject.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | netcoreapp3.1 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /BiliAccount.Core31TestProject/Program.cs: -------------------------------------------------------------------------------- 1 | using BiliAccount.Linq; 2 | using System; 3 | using System.Drawing; 4 | using System.Reflection; 5 | using System.Text; 6 | using System.Threading; 7 | using System.Threading.Tasks; 8 | 9 | namespace BiliAccount.Core31TestProject 10 | { 11 | class Program 12 | { 13 | static bool q = false; 14 | [STAThread] 15 | static void Main(string[] args) 16 | { 17 | Task t = Task.Run(() => 18 | { 19 | ByQRCode.QrCodeStatus_Changed += ByQRCode_QrCodeStatus_Changed; 20 | ByQRCode.QrCodeRefresh += ByQRCode_QrCodeRefresh; 21 | ByQRCode.LoginByQrCode().Save("tmp.jpg"); 22 | while (true) 23 | { 24 | 25 | } 26 | }); 27 | t.Wait(); 28 | } 29 | 30 | private static void ByQRCode_QrCodeRefresh(Bitmap newQrCode) 31 | { 32 | newQrCode.Save("tmp.jpg"); 33 | } 34 | 35 | private static void ByQRCode_QrCodeStatus_Changed(ByQRCode.QrCodeStatus status, Account account = null) 36 | { 37 | Console.WriteLine(status); 38 | if (account != null) { Console.WriteLine(var_dump(account)); q = true; } 39 | } 40 | 41 | /// 42 | /// equiv of PHP's var dump for an object’s properties because i cbf writing all the properties out. 43 | /// 44 | /// 45 | private static string var_dump(object info) 46 | { 47 | StringBuilder sb = new StringBuilder(); 48 | 49 | Type t = info.GetType(); 50 | FieldInfo[] props = t.GetFields(); 51 | sb.AppendFormat("{0,-25} {1}", "Name", "Value"); 52 | sb.AppendLine(); 53 | 54 | foreach (FieldInfo prop in props) 55 | { 56 | try 57 | { 58 | if (prop.GetValue(info) != null) 59 | { 60 | sb.AppendFormat("{0,-25} {1}", prop.Name, prop.GetValue(info).ToString()); 61 | sb.AppendLine(); 62 | } 63 | } 64 | catch { } 65 | } 66 | 67 | return sb.ToString(); 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /BiliAccount.Geetest.Controls/BiliAccount.Geetest.Controls.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net48;net472;net471;net47;net462;net461;net46;net452 5 | $(LibraryFrameworks) 6 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 7 | false 8 | BiliAccount.Geetest.Controls 9 | true 10 | 1.0.3.3 11 | LeoChen 12 | zhangbudademao.com 13 | Copyright © 2020 zhangbudademao.com, all rights reserved. 14 | MIT 15 | https://github.com/LeoChen98/BiliAccount.Geetest.Controls 16 | https://github.com/LeoChen98/BiliAccount.Geetest.Controls 17 | git 18 | bilibili bililive bililogin biliaccount 19 | favicon_4.png 20 | 1. 更新Chromium内核版本到86。(安全更新) 21 | 22 | true 23 | snupkg 24 | true 25 | x64;x86 26 | f19de9f9-31de-4361-a4f5-1b6f6e1aa3ce 27 | 28 | 29 | 30 | BiliAccount.Geetest.Controls 31 | BiliAccount.Geetest.Controls 32 | 用于处理B站账号操作过程中的极验验证码的控件和窗体 33 | 34 | 35 | 36 | BiliAccount.Geetest.Controls.x64 37 | BiliAccount.Geetest.Controls.x64 38 | 用于处理B站账号操作过程中的极验验证码的控件和窗体(x64版本) 39 | 40 | 41 | 42 | BiliAccount.Geetest.Controls .NET 4.5.2 43 | NETFRAMEWORK;NET452;$(AdditionalConstants);X86 44 | 45 | 46 | BiliAccount.Geetest.Controls .NET 4.6 47 | NETFRAMEWORK;NET46;$(AdditionalConstants);X86 48 | 49 | 50 | BiliAccount.Geetest.Controls .NET 4.6.1 51 | NETFRAMEWORK;NET61;$(AdditionalConstants);X86 52 | 53 | 54 | BiliAccount.Geetest.Controls .NET 4.6.2 55 | NETFRAMEWORK;NET462;$(AdditionalConstants);X86 56 | 57 | 58 | BiliAccount.Geetest.Controls .NET 4.7 59 | NETFRAMEWORK;NET47;$(AdditionalConstants);X86 60 | 61 | 62 | BiliAccount.Geetest.Controls .NET 4.7.1 63 | NETFRAMEWORK;NET471;$(AdditionalConstants);X86 64 | 65 | 66 | BiliAccount.Geetest.Controls .NET 4.7.2 67 | NETFRAMEWORK;NET472;$(AdditionalConstants);X86 68 | 69 | 70 | BiliAccount.Geetest.Controls .NET 4.8 71 | NETFRAMEWORK;NET48;$(AdditionalConstants);X86 72 | 73 | 74 | 75 | BiliAccount.Geetest.Controls .NET 4.5.2 x64 76 | NETFRAMEWORK;NET452;$(AdditionalConstants);X64 77 | 78 | 79 | BiliAccount.Geetest.Controls .NET 4.6 x64 80 | NETFRAMEWORK;NET46;$(AdditionalConstants);X64 81 | 82 | 83 | BiliAccount.Geetest.Controls .NET 4.6.1 x64 84 | NETFRAMEWORK;NET61;$(AdditionalConstants);X64 85 | 86 | 87 | BiliAccount.Geetest.Controls .NET 4.6.2 x64 88 | NETFRAMEWORK;NET462;$(AdditionalConstants);X64 89 | 90 | 91 | BiliAccount.Geetest.Controls .NET 4.7 x64 92 | NETFRAMEWORK;NET47;$(AdditionalConstants);X64 93 | 94 | 95 | BiliAccount.Geetest.Controls .NET 4.7.1 x64 96 | NETFRAMEWORK;NET471;$(AdditionalConstants);X64 97 | 98 | 99 | BiliAccount.Geetest.Controls .NET 4.7.2 x64 100 | NETFRAMEWORK;NET472;$(AdditionalConstants);X64 101 | 102 | 103 | BiliAccount.Geetest.Controls .NET 4.8 x64 104 | NETFRAMEWORK;NET48;$(AdditionalConstants);X64 105 | 106 | 107 | 108 | portable 109 | true 110 | Auto 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | True 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | True 160 | True 161 | Resources.resx 162 | 163 | 164 | 165 | 166 | 167 | 168 | GeetestBrowserWindow.xaml 169 | 170 | 171 | GeetestBrowser.xaml 172 | 173 | 174 | Designer 175 | MSBuild:Compile 176 | 177 | 178 | MSBuild:Compile 179 | Designer 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | ResXFileCodeGenerator 190 | Resources.Designer.cs 191 | 192 | 193 | 194 | 195 | 196 | 197 | -------------------------------------------------------------------------------- /BiliAccount.Geetest.Controls/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码由工具生成。 4 | // 运行时版本:4.0.30319.42000 5 | // 6 | // 对此文件的更改可能会导致不正确的行为,并且如果 7 | // 重新生成代码,这些更改将会丢失。 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace BiliAccount.Geetest.Controls.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// 一个强类型的资源类,用于查找本地化的字符串等。 17 | /// 18 | // 此类是由 StronglyTypedResourceBuilder 19 | // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 20 | // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen 21 | // (以 /str 作为命令选项),或重新生成 VS 项目。 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// 返回此类使用的缓存的 ResourceManager 实例。 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("BiliAccount.Geetest.Controls.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// 重写当前线程的 CurrentUICulture 属性 51 | /// 重写当前线程的 CurrentUICulture 属性。 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /BiliAccount.Geetest.Controls/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | text/microsoft-resx 91 | 92 | 93 | 1.3 94 | 95 | 96 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 97 | 98 | 99 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 100 | 101 | -------------------------------------------------------------------------------- /BiliAccount.Geetest.Controls/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "TestProject": { 4 | "commandName": "Executable" 5 | } 6 | } 7 | } -------------------------------------------------------------------------------- /BiliAccount.Geetest.Controls/WPF/GeetestBrowser.xaml: -------------------------------------------------------------------------------- 1 |  12 | 13 | 14 | -------------------------------------------------------------------------------- /BiliAccount.Geetest.Controls/WPF/GeetestBrowser.xaml.cs: -------------------------------------------------------------------------------- 1 | using CefSharp; 2 | using CefSharp.Wpf; 3 | using System.Windows; 4 | using System.Windows.Controls; 5 | 6 | namespace BiliAccount.Geetest.Controls.WPF 7 | { 8 | /// 9 | /// DataViewer.xaml 的交互逻辑 10 | /// 11 | public partial class GeetestBrowser : UserControl 12 | { 13 | #region Private Fields 14 | 15 | private ChromiumWebBrowser browser; 16 | 17 | #endregion Private Fields 18 | 19 | #region Public Constructors 20 | 21 | /// 22 | /// 初始化GeetestBrowser 23 | /// 24 | public GeetestBrowser() 25 | { 26 | InitializeComponent(); 27 | } 28 | 29 | #endregion Public Constructors 30 | 31 | #region Public Delegates 32 | 33 | /// 34 | /// 验证成功委托 35 | /// 36 | /// challenge 37 | /// key 38 | /// validate值 39 | public delegate void Vaildate_Success_Handler(string challenge, string key, string validate); 40 | 41 | #endregion Public Delegates 42 | 43 | #region Public Events 44 | 45 | /// 46 | /// 验证成功事件 47 | /// 48 | public event Vaildate_Success_Handler OnVaildate_Success; 49 | 50 | #endregion Public Events 51 | 52 | #region Public Properties 53 | 54 | /// 55 | /// 指示加载完毕后多少毫秒显示验证(建议不低于1500),在验证启动前修改有效,否则不会应用新的值。 56 | /// 57 | public int UIDelay { get; set; } = 3000; 58 | 59 | #endregion Public Properties 60 | 61 | #region Public Methods 62 | 63 | /// 64 | /// 刷新验证页 65 | /// 66 | public void Refresh() 67 | { 68 | browser.Reload(); 69 | } 70 | 71 | /// 72 | /// 启动验证 73 | /// 74 | /// 验证地址 75 | public void StartVaildate(string url) 76 | { 77 | Geetest.OnValidate_Success += Geetest_OnValidate_Success; 78 | 79 | Geetest.StartValidate(); 80 | 81 | var settings = new CefSettings(); 82 | 83 | settings.CefCommandLineArgs.Add("proxy-server", $"127.0.0.1:{Geetest.Port}"); 84 | settings.CefCommandLineArgs.Add("enable-media-stream", "1"); 85 | settings.CefCommandLineArgs.Add("disable-gpu", "1"); 86 | 87 | Cef.Initialize(settings); 88 | 89 | browser = new ChromiumWebBrowser() { Width = content.Width, Height = content.Height }; 90 | 91 | content.Children.Add(browser); 92 | 93 | browser.Margin = new Thickness(0, 0, 0, 0); 94 | browser.Address = url; 95 | browser.FrameLoadEnd += Browser_FrameLoadEnd; 96 | } 97 | 98 | #endregion Public Methods 99 | 100 | #region Private Methods 101 | 102 | private void Browser_FrameLoadEnd(object sender, FrameLoadEndEventArgs e) 103 | { 104 | browser.GetMainFrame().ExecuteJavaScriptAsync("document.body.style.display='none';" + 105 | "setTimeout(document.getElementById('app').style.display = 'none',100);" + 106 | "setTimeout(function(){" + 107 | "document.getElementById('send-btn').click();" + 108 | "document.getElementsByClassName('geetest_panel_ghost')[0].remove();" + 109 | "document.body.style.display='block'" + 110 | $"}},{UIDelay}); "); 111 | } 112 | 113 | private void Geetest_OnValidate_Success(string challenge, string key, string validate) 114 | { 115 | try 116 | { 117 | content.Children.Remove(browser); 118 | browser.Visibility = Visibility.Hidden; 119 | browser.Dispose(); 120 | Cef.Shutdown(); 121 | } 122 | catch { } 123 | 124 | OnVaildate_Success(challenge, key, validate); 125 | } 126 | 127 | #endregion Private Methods 128 | } 129 | } -------------------------------------------------------------------------------- /BiliAccount.Geetest.Controls/WPF/GeetestBrowserWindow.xaml: -------------------------------------------------------------------------------- 1 |  11 | 12 | 13 | 14 |