Skip to content

Commit

Permalink
add description
Browse files Browse the repository at this point in the history
  • Loading branch information
anoshop committed May 27, 2020
1 parent e861927 commit 8e49166
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Anti web crawl,


## Feature

- reject dev tool
- run a javascript command if chome headless deteactd.
- get browser fingerprint and post to SOME URL



## Install


Expand Down Expand Up @@ -29,7 +38,10 @@ to the require section of your `composer.json` file.
<?= \mallka\anticrawl\Anti::widget([
//the url of upload fingerprint,it will not fetch fingerprint if not set
'uploadFingerUrl'=>Url::to(['/anticrawl/anti-log/create']),
'uploadFingerUrl'=>Url::to(['/anticrawl/anti-log/create']),
//run js command if chrome headless detected.default is alert
'homelessJsCmd'=>'window.location.href="xxxxx";',
]);?>
```
Expand Down
8 changes: 7 additions & 1 deletion src/Anti.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class Anti extends \yii\base\Widget
{

public $uploadFingerUrl;
public $homelessJsCmd;

public function init()
{
Expand All @@ -21,7 +22,12 @@ public function run()
{

$this->stopDebugger();
$this->stopChromeHeadless();


if($this->homelessJsCmd!=null)
$this->stopChromeHeadless($this->homelessJsCmd);
else
$this->stopChromeHeadless();

if($this->uploadFingerUrl!=null)
$this->uploadFingerprint($this->uploadFingerUrl);
Expand Down

0 comments on commit 8e49166

Please sign in to comment.