Skip to content
This repository was archived by the owner on May 25, 2022. It is now read-only.

Commit b563065

Browse files
Merge pull request #1 from chavarera/master
new updates until 11 July 2020
2 parents 2f20d75 + 9ca7a0e commit b563065

File tree

9 files changed

+130
-21
lines changed

9 files changed

+130
-21
lines changed

.github/ISSUE_TEMPLATE/feature_request.md

Lines changed: 0 additions & 20 deletions
This file was deleted.

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,8 @@ Sr no | Project Name | Author
4040
18 | [Send emails](https://github.com/chavarera/python-mini-projects/tree/master/projects/send%20email%20from%20CSV) | [Mitesh](https://github.com/Mitesh2499)
4141
19 | [Get Ipaddress and Hostname of Website](https://github.com/chavarera/python-mini-projects/tree/master/projects/Find%20Out%20Hostname%20and%20IP%20address) | [Nuh Mohammed](https://github.com/NuhMohammed)|
4242
20 | [Progressbar using tqdm](https://github.com/chavarera/python-mini-projects/tree/master/projects/Terminal%20Progress%20Bar%20with%20Images%20Resizing) | [Mitesh](https://github.com/Mitesh2499)
43+
21 | [Get meta information of images](https://github.com/Xlgd/python-mini-projects/tree/master/projects/Get%20meta%20information%20of%20images) | [Gaodong](https://github.com/xlgd)
44+
22 | [Captures Frames from video](https://github.com/chavarera/python-mini-projects/tree/master/projects/Capture_Video_Frames) | [phileinSophos](https://github.com/phileinSophos/)
45+
23 | [Fetch Wifi Saved Password Windows](https://github.com/chavarera/python-mini-projects/tree/master/projects/Get%20Wifi%20password) | [Mitesh](https://github.com/Mitesh2499)
46+
24 | [Save Screenshot of given Website](https://github.com/chavarera/python-mini-projects/tree/master/projects/snapshot%20of%20given%20website) | [m044de](https://github.com/m044de/)
4347

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Capture Video Frames
2+
##### Execute
3+
`python capture_video_frames.py <video_file>`
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import os
2+
import shutil
3+
import sys
4+
import cv2
5+
6+
class FrameCapture:
7+
'''
8+
Class definition to capture frames
9+
'''
10+
def __init__(self, file_path):
11+
'''
12+
initializing directory where the captured frames will be stored.
13+
Also truncating the directory where captured frames are stored, if exists.
14+
'''
15+
self.directory = "captured_frames"
16+
self.file_path = file_path
17+
if os.path.exists(self.directory):
18+
shutil.rmtree(self.directory)
19+
os.mkdir(self.directory)
20+
21+
def capture_frames(self):
22+
'''
23+
This method captures the frames from the video file provided.
24+
This program makes use of openCV library
25+
'''
26+
cv2_object = cv2.VideoCapture(self.file_path)
27+
28+
frame_number = 0
29+
frame_found = 1
30+
31+
while frame_found:
32+
frame_found, image = cv2_object.read()
33+
capture = f'{self.directory}/frame{frame_number}.jpg'
34+
cv2.imwrite(capture, image)
35+
36+
frame_number += 1
37+
38+
if __name__ == '__main__':
39+
file_path = sys.argv[1]
40+
fc = FrameCapture(file_path)
41+
fc.capture_frames()

projects/Get Wifi password/wifi.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import subprocess
2+
3+
data = (
4+
subprocess.check_output(["netsh", "wlan", "show", "profiles"])
5+
.decode("utf-8")
6+
.split("\n")
7+
)
8+
profiles = [i.split(":")[1][1:-1] for i in data if "All User Profile" in i]
9+
for i in profiles:
10+
results = (
11+
subprocess
12+
.check_output(["netsh", "wlan", "show", "profile", i, "key=clear"])
13+
.decode("utf-8")
14+
.split("\n")
15+
)
16+
results = [b.split(":")[1][1:-1] for b in results if "Key Content" in b]
17+
try:
18+
print("{:<30}| {:<}".format(i, results[0]))
19+
except IndexError:
20+
print("{:<30}| {:<}".format(i, ""))
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
## Get meta information of images
2+
3+
### usage
4+
5+
python get_meta_from_pic image_name
6+
7+
### note
8+
9+
Make sure the picture contains location information, otherwise the location cannot be obtained
10+
11+
you need fill in your email address to use the function in gps_utils.py:
12+
```python
13+
geolocator = Nominatim(user_agent = "your email")
14+
```

projects/Get meta information of images/gps_utils.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
def format_lati_long(data):
66
list_tmp=str(data).replace('[', '').replace(']', '').split(',')
77
list=[ele.strip() for ele in list_tmp]
8-
data_sec = int(list[-1].split('/')[0]) /(int(list[-1].split('/')[1])*3600)
8+
if (list[-1].find('/') != -1):
9+
data_sec = int(list[-1].split('/')[0]) /(int(list[-1].split('/')[1])*3600)
10+
else:
11+
data_sec = int(list[-1])/3600
912
data_minute = int(list[1])/60
1013
data_degree = int(list[0])
1114
result=data_degree + data_minute + data_sec
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# snapshot of given website
2+
3+
## Set up
4+
`pip install selenium`
5+
`pip install chromedriver-binary==XX.X.XXXX.XX.X`
6+
7+
- 'XX.X.XXXX.XX.X' is chrome driver version.
8+
- The version of 'chrome driver' need to match the version of your google chrome.
9+
10+
*How to find your google chrome version*
11+
1. Click on the Menu icon in the upper right corner of the screen.
12+
2. Click on Help, and then About Google Chrome.
13+
3. Your Chrome browser version number can be found here.
14+
15+
16+
## Execute
17+
`python snapshot_of_given_website.py <url>`
18+
Snapshot is in current directory after this script runs.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# -*- cofing: utf-8 -*-
2+
import sys
3+
from selenium import webdriver
4+
from selenium.webdriver.chrome.options import Options
5+
import chromedriver_binary
6+
7+
8+
script_name = sys.argv[0]
9+
10+
options = Options()
11+
options.add_argument('--headless')
12+
driver = webdriver.Chrome(options=options)
13+
14+
try:
15+
url = sys.argv[1]
16+
17+
driver.get(url)
18+
page_width = driver.execute_script('return document.body.scrollWidth')
19+
page_height = driver.execute_script('return document.body.scrollHeight')
20+
driver.set_window_size(page_width, page_height)
21+
driver.save_screenshot('screenshot.png')
22+
driver.quit()
23+
print("SUCCESS")
24+
25+
except IndexError:
26+
print('Usage: %s URL' % script_name)

0 commit comments

Comments
 (0)