Skip to content

Commit

Permalink
bump version to 6.2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
leovan committed Sep 10, 2023
1 parent c24b303 commit c953c85
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## [6.2.3](https://github.com/leovan/SciHubEVA/compare/v6.2.2...v6.2.3) (2023-09-10)

### Bug Fixes

- Fix DDos-Guard bypass cookies handling.

## [6.2.2](https://github.com/leovan/SciHubEVA/compare/v6.2.1...v6.2.2) (2023-09-09)

### Features
Expand Down
14 changes: 7 additions & 7 deletions scihub_eva/utils/network_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@


urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)


def get_adapter():
retry_times = Preferences.get_or_default(
Expand Down Expand Up @@ -77,17 +77,17 @@ def ddos_guard_bypass(url, sess: Session):
url = re.sub('/+$', '', url)
check_resp = sess.get(url)

if (check_resp.status_code != 403
or check_resp.headers.get('server', None) != 'ddos-guard'):
return
else:
if (check_resp.status_code == 403
or check_resp.headers.get('server', '').lower() == 'ddos-guard'):
set_cookies(sess, check_resp)
else:
return

guard_resp = sess.get(f'{url}/.well-known/ddos-guard/check?context=free_splash')
if guard_resp.status_code != 200:
return
else:
set_cookies(sess, check_resp)
set_cookies(sess, guard_resp)

with open((CONFS_DIR / 'ddos-guard-fake-mark.json').resolve().as_posix()) as f:
fake_mark = json.load(f)
Expand All @@ -96,7 +96,7 @@ def ddos_guard_bypass(url, sess: Session):
if mark_resp != 200:
return
else:
set_cookies(sess, check_resp)
set_cookies(sess, mark_resp)

url = re.sub('/+$', '', url)
check_resp = sess.get(url)
Expand Down

0 comments on commit c953c85

Please sign in to comment.