From 2d44cd6ce545e807faf8bac0c4774c9ec858850f Mon Sep 17 00:00:00 2001 From: Fabrizio Romano Date: Mon, 11 Apr 2022 17:27:25 +0100 Subject: [PATCH 1/7] Add warning note in README (as per https://github.com/justingdbyrne suggestion). --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 242b349..b3ff9d8 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,16 @@ that might suit you better. We have given the virtual environment folder the name `.venv`. Feel free to choose any other name that you might want. +--- + +Note: the above procedure might fail in some of the chapter folders, due +to the presence of files that aren't meant to be run. If that is the case, you +should choose another folder where to place your virtual environment. You can +create one within the chapter folder itself, or place the virtual environment +outside of the chapter folder altogether. + +--- + Next step is to activate the virtual environment: $ source .venv/bin/activate From 6a155317776fce18f65821194c62cf3cc28c40ef Mon Sep 17 00:00:00 2001 From: packtutkarshr <48279450+packtutkarshr@users.noreply.github.com> Date: Thu, 26 May 2022 16:05:03 +0530 Subject: [PATCH 2/7] add $10 campaign --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index b3ff9d8..c58edf4 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,7 @@ +## [Get this title for $10 on Packt's Spring Sale](https://www.packt.com/B17579?utm_source=github&utm_medium=packt-github-repo&utm_campaign=spring_10_dollar_2022) +----- +For a limited period, all eBooks and Videos are only $10. All the practical content you need \- by developers, for developers + # Learn Python Programming 3rd Edition Welcome to Learn Python Programming, 3rd Edition. From 3aebd9f5655abed735087e2f6fb4d1c899168f6a Mon Sep 17 00:00:00 2001 From: packtutkarshr <48279450+packtutkarshr@users.noreply.github.com> Date: Mon, 13 Jun 2022 20:30:16 +0530 Subject: [PATCH 3/7] remove $10 campaign --- README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.md b/README.md index c58edf4..b3ff9d8 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,3 @@ -## [Get this title for $10 on Packt's Spring Sale](https://www.packt.com/B17579?utm_source=github&utm_medium=packt-github-repo&utm_campaign=spring_10_dollar_2022) ------ -For a limited period, all eBooks and Videos are only $10. All the practical content you need \- by developers, for developers - # Learn Python Programming 3rd Edition Welcome to Learn Python Programming, 3rd Edition. From fcccb7c7264f5063a9fc103e425a072778a20b3a Mon Sep 17 00:00:00 2001 From: TrellixVulnTeam Date: Thu, 6 Oct 2022 10:59:16 +0000 Subject: [PATCH 4/7] Adding tarfile member sanitization to extractall() --- ch08/files/compression/tar.py | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/ch08/files/compression/tar.py b/ch08/files/compression/tar.py index 69af6c2..593c0fc 100644 --- a/ch08/files/compression/tar.py +++ b/ch08/files/compression/tar.py @@ -8,4 +8,26 @@ tar.add('subfolder/content4.txt') with tarfile.open('example.tar.gz', 'r:gz') as tar: - tar.extractall('extract_tar') + + import os + + def is_within_directory(directory, target): + + abs_directory = os.path.abspath(directory) + abs_target = os.path.abspath(target) + + prefix = os.path.commonprefix([abs_directory, abs_target]) + + return prefix == abs_directory + + def safe_extract(tar, path=".", members=None, *, numeric_owner=False): + + for member in tar.getmembers(): + member_path = os.path.join(path, member.name) + if not is_within_directory(path, member_path): + raise Exception("Attempted Path Traversal in Tar File") + + tar.extractall(path, members, numeric_owner=numeric_owner) + + + safe_extract(tar, "extract_tar") From 5131d874c1ff7608df7206d73b35c237e1bc1aa1 Mon Sep 17 00:00:00 2001 From: Packt-ITService <62882280+Packt-ITService@users.noreply.github.com> Date: Fri, 21 Oct 2022 10:31:18 +0100 Subject: [PATCH 5/7] add free ebook notification --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index b3ff9d8..77c1617 100644 --- a/README.md +++ b/README.md @@ -62,3 +62,7 @@ find all the instructions you need in the chapter's text. **Note**: Always remember to activate the virtual environment before you install third-party libraries. +### Download a free PDF + + If you have already purchased a print or Kindle version of this book, you can get a DRM-free PDF version at no cost.
Simply click on the link to claim your free PDF.
+

https://packt.link/free-ebook/9781801815093

\ No newline at end of file From a9b44fb2016974b23a43b1b355e67f2f3da7bf51 Mon Sep 17 00:00:00 2001 From: Packt-ITService <62882280+Packt-ITService@users.noreply.github.com> Date: Wed, 14 Dec 2022 13:09:07 +0530 Subject: [PATCH 6/7] add free ebook notification --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index 77c1617..6170729 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,15 @@ + +### Get this product for $5 + +Packt is having its biggest sale of the year. Get this eBook or any other book, video, or course that you like just for $5 each + + +

[Buy now](https://packt.link/9781801815093)

+ + +

[Buy similar titles for just $5](https://subscription.packtpub.com/search)

+ + # Learn Python Programming 3rd Edition Welcome to Learn Python Programming, 3rd Edition. From 8f08c1b031972e57b8b9a28b85a903a5ee2bd0cb Mon Sep 17 00:00:00 2001 From: Packt-ITService <62882280+Packt-ITService@users.noreply.github.com> Date: Wed, 18 Jan 2023 14:57:10 +0530 Subject: [PATCH 7/7] remove 5$ campaign - 2022 --- README.md | 9 --------- 1 file changed, 9 deletions(-) diff --git a/README.md b/README.md index 6170729..047c443 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,4 @@ -### Get this product for $5 - -Packt is having its biggest sale of the year. Get this eBook or any other book, video, or course that you like just for $5 each - - -

[Buy now](https://packt.link/9781801815093)

- - -

[Buy similar titles for just $5](https://subscription.packtpub.com/search)

# Learn Python Programming 3rd Edition