Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fb9df0e

Browse files
author
root
committed
cli
0 parents  commit fb9df0e

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import requests
2+
import json
3+
from bs4 import BeautifulSoup
4+
from random import randint
5+
import time
6+
page_num = randint(1, 11)
7+
jokes={}
8+
url=("http://123hindijokes.com/very-funny-jokes/"+str(page_num))
9+
r = requests.get(url)
10+
data=BeautifulSoup(r.content,"lxml")
11+
joke=data.find_all("ul",{"class":"statusList"})
12+
for i in joke:
13+
joke1 =i.find_all('li')
14+
for joke2 in joke1:
15+
joke3=joke2.get_text()
16+
jokes[1]=joke3
17+
with open("hindijoke.json",'w') as joke3:
18+
json.dump(jokes,joke3,ensure_ascii=False,indent=8)
19+
time.sleep(15)
20+
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import os
2+
import platform
3+
import json
4+
import sys
5+
import psutil
6+
import uuid
7+
from netifaces import AF_INET, AF_INET6, AF_LINK, AF_PACKET, AF_BRIDGE
8+
import netifaces as ni
9+
import socket
10+
import requests
11+
REMOTE_SERVER = "www.google.com"
12+
def is_connected():
13+
try:
14+
host = socket.gethostbyname(REMOTE_SERVER)
15+
s = socket.create_connection((host, 80), 2)
16+
return True
17+
except:
18+
pass
19+
return False
20+
info={}
21+
info['system']={}
22+
info['system']['MAC'] = ':'.join(['{:02x}'.format((uuid.getnode() >> i) & 0xff) for i in range(0,8*6,8)][::-1])
23+
info['system']['processortype'] = platform.machine()
24+
info['system']['hostname'] = platform.node()
25+
info['system']['os'] = platform.system()
26+
info['system']['kernelversion'] = platform.release()
27+
if(is_connected()):
28+
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
29+
s.connect(('8.8.8.8', 1)) # connect() for UDP doesn't send packets
30+
info['system']['private ip'] = s.getsockname()[0]
31+
info['system']['public ip']=requests.get('http://ip.42.pl/raw').text
32+
with open('info.json', 'w') as outfile:
33+
json.dump(info, outfile)

0 commit comments

Comments
 (0)