pylookyloo 1.29.0__py3-none-any.whl → 1.31.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of pylookyloo might be problematic. Click here for more details.

pylookyloo/api.py CHANGED
@@ -7,6 +7,7 @@ import base64
7
7
  import warnings
8
8
 
9
9
  from datetime import datetime
10
+ from hashlib import sha512
10
11
  from importlib.metadata import version
11
12
  from io import BytesIO, StringIO
12
13
  from typing import Any, TypedDict, overload, Literal
@@ -391,6 +392,14 @@ class Lookyloo():
391
392
  r = self.session.post(urljoin(self.root_url, str(PurePosixPath('admin', tree_uuid, 'remove'))))
392
393
  return r.json()
393
394
 
395
+ def get_favicons(self, capture_uuid: str) -> dict[str, Any]:
396
+ '''Returns the potential favicons of the capture.
397
+
398
+ :param capture_uuid: UUID of the capture
399
+ '''
400
+ r = self.session.get(urljoin(self.root_url, str(PurePosixPath('json', capture_uuid, 'favicons'))))
401
+ return r.json()
402
+
394
403
  def get_redirects(self, capture_uuid: str) -> dict[str, Any]:
395
404
  '''Returns the initial redirects.
396
405
 
@@ -415,6 +424,14 @@ class Lookyloo():
415
424
  r = self.session.get(urljoin(self.root_url, str(PurePosixPath('json', capture_uuid, 'hostnames'))))
416
425
  return r.json()
417
426
 
427
+ def get_ips(self, capture_uuid: str) -> dict[str, Any]:
428
+ '''Returns all the IPs seen during the capture.
429
+
430
+ :param capture_uuid: UUID of the capture
431
+ '''
432
+ r = self.session.get(urljoin(self.root_url, str(PurePosixPath('json', capture_uuid, 'ips'))))
433
+ return r.json()
434
+
418
435
  def get_screenshot(self, capture_uuid: str) -> BytesIO:
419
436
  '''Returns the screenshot.
420
437
 
@@ -475,35 +492,78 @@ class Lookyloo():
475
492
  r = self.session.get(urljoin(self.root_url, str(PurePosixPath('bin', capture_uuid, 'export'))))
476
493
  return BytesIO(r.content)
477
494
 
478
- def get_hash_occurrences(self, h: str) -> dict[str, Any]:
479
- '''Returns the base 64 body related the the hash, and a list of all the captures containing that hash.
495
+ def get_hash_occurrences(self, h: str, *, with_urls_occurrences: bool=False, cached_captures_only: bool=True, limit: int=20, offset: int=0) -> dict[str, Any]:
496
+ '''Returns the base64 body related the the hash, and a list of all the captures containing that hash.
480
497
 
481
498
  :param h: sha512 to search
499
+ :param with_urls_occurrences: If true, add details about the URLs from the URL nodes in the tree.
500
+ :param cached_captures_only: If False, Lookyloo will attempt to re-cache the missing captures. It might take some time.
501
+ :param limit: The max amount of entries to return.
502
+ :param offset: The offset to start from, useful for pagination.
482
503
  '''
483
- r = self.session.get(urljoin(self.root_url, str(PurePosixPath('json', 'hash_info', h))))
504
+ r = self.session.post(urljoin(self.root_url, str(PurePosixPath('json', 'hash_info'))),
505
+ json={'body_hash': h, 'with_urls_occurrences': with_urls_occurrences,
506
+ 'cached_captures_only': cached_captures_only, 'limit': limit, 'offset': offset})
484
507
  return r.json()
485
508
 
486
- def get_url_occurrences(self, url: str, limit: int=20, cached_captures_only: bool=True) -> dict[str, Any]:
509
+ def get_url_occurrences(self, url: str, *, with_urls_occurrences: bool=False, cached_captures_only: bool=True, limit: int=20, offset: int=0) -> dict[str, Any]:
487
510
  '''Returns all the captures contining the URL
488
511
 
489
512
  :param url: URL to lookup
490
- :param limit: The max amount of entries to return.
513
+ :param with_urls_occurrences: If true, add details about the URLs from the URL nodes in the tree.
491
514
  :param cached_captures_only: If False, Lookyloo will attempt to re-cache the missing captures. It might take some time.
515
+ :param limit: The max amount of entries to return.
516
+ :param offset: The offset to start from, useful for pagination.
492
517
  '''
493
518
  r = self.session.post(urljoin(self.root_url, str(PurePosixPath('json', 'url_info'))),
494
- json={'url': url, 'limit': limit})
519
+ json={'url': url, 'with_urls_occurrences': with_urls_occurrences,
520
+ 'cached_captures_only': cached_captures_only,
521
+ 'limit': limit, 'offset': offset})
495
522
  return r.json()
496
523
 
497
- def get_hostname_occurrences(self, hostname: str, with_urls_occurrences: bool=False, limit: int=20, cached_captures_only: bool=True) -> dict[str, Any]:
498
- '''Returns all the captures contining the hostname. It will be pretty slow on very common domains.
524
+ def get_hostname_occurrences(self, hostname: str, *, with_urls_occurrences: bool=False, cached_captures_only: bool=True, limit: int=20, offset: int=0) -> dict[str, Any]:
525
+ '''Returns all the captures contining the hostname.
499
526
 
500
527
  :param hostname: Hostname to lookup
501
528
  :param with_urls_occurrences: If true, add details about the related URLs.
502
- :param limit: The max amount of entries to return.
503
529
  :param cached_captures_only: If False, Lookyloo will attempt to re-cache the missing captures. It might take some time.
530
+ :param limit: The max amount of entries to return.
531
+ :param offset: The offset to start from, useful for pagination.
504
532
  '''
505
533
  r = self.session.post(urljoin(self.root_url, str(PurePosixPath('json', 'hostname_info'))),
506
- json={'hostname': hostname, 'with_urls_occurrences': with_urls_occurrences, 'limit': limit})
534
+ json={'hostname': hostname, 'with_urls_occurrences': with_urls_occurrences,
535
+ 'cached_captures_only': cached_captures_only,
536
+ 'limit': limit, 'offset': offset})
537
+ return r.json()
538
+
539
+ def get_ip_occurrences(self, ip: str, *, with_urls_occurrences: bool=False, cached_captures_only: bool=True, limit: int=20, offset: int=0) -> dict[str, Any]:
540
+ '''Returns all the captures containing the IP address.
541
+
542
+ :param ip: IP to lookup
543
+ :param with_urls_occurrences: If true, add details about the related URLs.
544
+ :param cached_captures_only: If False, Lookyloo will attempt to re-cache the missing captures. It might take some time.
545
+ :param limit: The max amount of entries to return.
546
+ :param offset: The offset to start from, useful for pagination.
547
+ '''
548
+ r = self.session.post(urljoin(self.root_url, str(PurePosixPath('json', 'ip_info'))),
549
+ json={'ip': ip, 'with_urls_occurrences': with_urls_occurrences,
550
+ 'cached_captures_only': cached_captures_only,
551
+ 'limit': limit})
552
+ return r.json()
553
+
554
+ def get_favicon_occurrences(self, favicon: str | BytesIO, *, cached_captures_only: bool=True, limit: int=20, offset: int=0) -> dict[str, Any]:
555
+ '''Returns all the captures containing the favicon.
556
+
557
+ :param favicon: Favicon to lookup. Either the hash, or the file in a BytesIO (hash will be generated on the fly)
558
+ :param cached_captures_only: If False, Lookyloo will attempt to re-cache the missing captures. It might take some time.
559
+ :param limit: The max amount of entries to return.
560
+ :param offset: The offset to start from, useful for pagination.
561
+ '''
562
+ if isinstance(favicon, BytesIO):
563
+ favicon = sha512(favicon.read()).hexdigest()
564
+ r = self.session.post(urljoin(self.root_url, str(PurePosixPath('json', 'favicon_info'))),
565
+ json={'favicon': favicon, 'cached_captures_only': cached_captures_only,
566
+ 'limit': limit, 'offset': offset})
507
567
  return r.json()
508
568
 
509
569
  def get_stats(self) -> dict[str, Any]:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pylookyloo
3
- Version: 1.29.0
3
+ Version: 1.31.0
4
4
  Summary: Python CLI and module for Lookyloo
5
5
  License: GPL-2.0-or-later
6
6
  Author: Raphaël Vinot
@@ -24,8 +24,8 @@ Classifier: Topic :: Security
24
24
  Provides-Extra: docs
25
25
  Provides-Extra: examples
26
26
  Requires-Dist: Sphinx (>=8.2.3) ; (python_version >= "3.11") and (extra == "docs")
27
- Requires-Dist: pylacus (>=1.14.0) ; extra == "examples"
28
- Requires-Dist: requests (>=2.32.3)
27
+ Requires-Dist: pylacus (>=1.15.1) ; extra == "examples"
28
+ Requires-Dist: requests (>=2.32.4)
29
29
  Project-URL: Documentation, https://pylookyloo.readthedocs.io/en/latest/
30
30
  Project-URL: Repository, https://github.com/lookyloo/PyLookyloo
31
31
  Project-URL: issues, https://github.com/lookyloo/PyLookyloo/issues
@@ -0,0 +1,8 @@
1
+ pylookyloo/__init__.py,sha256=_JYXwXHL7ShZkeruvGd8qDTpxNRfuDjvV65SOMMU6yc,1922
2
+ pylookyloo/api.py,sha256=xnNcBcb0IYDf5eUn0JPPcqV_3z0o9lOEdOr5H1cCT38,35783
3
+ pylookyloo/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
+ pylookyloo-1.31.0.dist-info/LICENSE,sha256=4C4hLYrIkUD96Ggk-y_Go1Qf7PBZrEm9PSeTGe2nd4s,1516
5
+ pylookyloo-1.31.0.dist-info/METADATA,sha256=xj4MHoeh22VpwhYGSFIcpiiDemuR504dAwJRHWZ5dgc,2387
6
+ pylookyloo-1.31.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
7
+ pylookyloo-1.31.0.dist-info/entry_points.txt,sha256=y2c0Ujg8co6Xyf7MoxStVU-fLQMZBSGAg-KFidmsha4,44
8
+ pylookyloo-1.31.0.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 2.1.2
2
+ Generator: poetry-core 2.1.3
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
@@ -1,8 +0,0 @@
1
- pylookyloo/__init__.py,sha256=_JYXwXHL7ShZkeruvGd8qDTpxNRfuDjvV65SOMMU6yc,1922
2
- pylookyloo/api.py,sha256=Udgl9O8R1IPzNCXfpP3zad7Y6Q0n2neVEWpAJQ58yHM,31907
3
- pylookyloo/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- pylookyloo-1.29.0.dist-info/LICENSE,sha256=4C4hLYrIkUD96Ggk-y_Go1Qf7PBZrEm9PSeTGe2nd4s,1516
5
- pylookyloo-1.29.0.dist-info/METADATA,sha256=69lw0CSTxdx9wv1H4Ltby-m52jSxjzm_ktD6Ysr7gsw,2387
6
- pylookyloo-1.29.0.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
7
- pylookyloo-1.29.0.dist-info/entry_points.txt,sha256=y2c0Ujg8co6Xyf7MoxStVU-fLQMZBSGAg-KFidmsha4,44
8
- pylookyloo-1.29.0.dist-info/RECORD,,