Skip to content

Commit

Permalink
first
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Feb 4, 2019
1 parent 197550d commit 257ee2e
Show file tree
Hide file tree
Showing 13 changed files with 323 additions and 0 deletions.
22 changes: 22 additions & 0 deletions facebook.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/python

from selenium import webdriver
import getpass

#from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
#caps=DesiredCapabilities.FIREFOX.copy()
#caps['marionette'] = False

email = raw_input("please enter your email id")
print "please enter your passsword"
password = getpass.getpass()
driver=webdriver.Firefox()
driver.get("https://www.facebook.com")

email_id = driver.find_element_by_name("email")
email_id.send_keys(email)

passwd = driver.find_element_by_name("pass")
passwd.send_keys(password)

sub = driver.find_element_by_id("u_0_2").submit()
36 changes: 36 additions & 0 deletions file_send/udpc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/python2

# receiver's code

import socket

s=socket.socket(socket.AF_INET,socket.SOCK_DGRAM)

p=("127.0.0.1",9090) # recv ip and port

buffer_size = 1024

s.bind(p) # receiver needs to bind ip and port

print "receiving now \n"

f=open('/root/ab.py','wb')

cnt=0
while True:
recv = s.recvfrom(buffer_size)
data = recv[0]
sock = recv[1]
while len(data)>0:
cnt=cnt+1
f.write(data)
#print cnt
s.sendto("got",sock)
data = s.recvfrom(buffer_size)[0]
print "done rec"
print cnt
break
f.close()
print "connection closed"
s.close()

34 changes: 34 additions & 0 deletions file_send/udps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/python2


# senders code

import socket
import commands

ip = "127.0.0.1" # this is ip of receiver
port = 9090 # recv port

recv_sock = (ip,port)

s=socket.socket(socket.AF_INET,socket.SOCK_DGRAM)


buffer_size = 1024
cnt =0

while True:
f=open('/root/index','rb')
l=f.read(buffer_size)
while (l):
s.sendto(l,recv_sock)
cnt = cnt+1
#print cnt
s.recvfrom(buffer_size)
l=f.read(buffer_size)
f.close()
s.sendto("",recv_sock)
break
print cnt
print " connection ended"

13 changes: 13 additions & 0 deletions flask/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/python
# coding: latin-1

from flask import Flask, redirect, url_for,request, render_template

app = Flask(__name__)

@app.route('/')
def index():
return render_template('index.html')

if __name__ == '__main__':
app.run(port=5000)
67 changes: 67 additions & 0 deletions flask/templates/extra.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<title>Details</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" type= "text/css" href="{{ url_for('static',filename='geoloc.css') }}">
</head>
<body>
<h1> Hello {{ name }} !! </h1>
<br>
<br>
<div class = "container">
{% if result|length==0 %}
<p id="tones"> No tweets </p>
{% else %}
<p id="text"> {{ text }} </p>
{% for tones in result %}
<p id="tones"> {{tones}} </p>
{% endfor %}
{% endif %}
</div>
<br>
<div class="container">
<p class="recommendation"> Here is a list of songs recommended for you !!</p>
<div class="row">
<div class="col-sm-6">
<p class="recommendation"> English Songs </p>
{% if songs|length==0 %}
<p class="songs"> No songs found for your mood </p>
{% else %}
{% for song in songs %}
<p class="songs"> {{song}} </p>
{% endfor %}
{% endif %}
</div>
<div class="col-sm-6">
<p class="recommendation"> Hindi Songs </p>
{% for song in hsongs %}
{% if song.sad %}
<p class="songs"> {{song.sad}} </p>
{% endif %}
{% if song.tentative %}
<p class="songs"> {{song.tentative}} </p>
{% endif %}
{% if song.happy %}
<p class="songs"> {{song.happy}} </p>
{% endif %}
{% endfor %}
</div>
</div>
</div>
<br>
<a href="#" id="get_location">Please click to know about doctors nearby</a>
<div id="map">
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?libraries=places&key=AIzaSyC7K6KW6K0yaNXw9mfPrRl-Z1zX99oGkA4"></script>
<script type="text/javascript" src="{{ url_for('static',filename='geoloc.js') }}"></script>
</body>
</html>
29 changes: 29 additions & 0 deletions flask/templates/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!DOCTYPE html>
<html lang="en">
<head>

<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<title>Details</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">

</head>
<body>
<div id="wrapper">
<div id="formDiv">
<form action = "/login" method = "post">
<label>Enter Twitter Handle:</label>
<input type = "text" name = "handle" class="inputFields" required="" />
<br><br>
<p><input type = "submit" value = "submit" id="submit"/></p>
</form>
</div>
</div>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>

</body>
</html>
7 changes: 7 additions & 0 deletions goodle_srch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/python

import webbrowser as wb

content = raw_input("enter content to be searched in google")
wb.open_new_tab("https://www.google.com/search?q="+content)

11 changes: 11 additions & 0 deletions os_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/python

import commands
import ram_cpu as rc
os_version = commands.getoutput("cat /etc/redhat-release")
print "Your os version is ",os_version


print "i am prinitng ",rc.ram
print "done showing everything"

9 changes: 9 additions & 0 deletions ram_cpu.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/python

import commands

ram = commands.getoutput("free -m").split()[7]
print "\n the ram in the system is ",ram

cpu = commands.getoutput("lscpu").split("\n")[12].split(":")[1]
print "\n the cpu of your system is ",cpu
23 changes: 23 additions & 0 deletions sshtry.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/python2

import os
import commands

msg = "AllowUsers [email protected]"

ip = ["192.168.43.77","192.168.43.236"]
passwd = ["5390","qwe"]
fil = "/etc/ssh/sshd_conf"

content = commands.getoutput("cat /etc/ssh/sshd_config")

'''
length = len(ip)
for i in range(length):
ssh = "sshpass -p "+passwd[i]+" ssh root@"+ip[i]
command = " 'echo '"+content+"' > '"+fil
commands.getstatusoutput(ssh+command)
print "done "
'''
29 changes: 29 additions & 0 deletions thread.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import socket
import thread

def send():
rec_ip1="192.168.43.237"
rec_port=9090
rec_ip2="192.168.43.77"
s=socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
while True:
data=raw_input()
s.sendto(data,(rec_ip1,rec_port))
s.sendto(data,(rec_ip2,rec_port))
#print s.recvfrom(11)


def recv():
rec_ip="192.168.43.233"
rec_port=9090
s=socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
s.bind((rec_ip,rec_port))
while True:
rec_data=s.recvfrom(100)
print rec_data[1][0]," : ",rec_data[0]


thread.start_new_thread(send,())
thread.start_new_thread(recv,())
while True:
pass
22 changes: 22 additions & 0 deletions udp/udpc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/python2

# receiver's code

import socket

s=socket.socket(socket.AF_INET,socket.SOCK_DGRAM)

p=("127.0.0.1",9090) # recv ip and port

buffer_size = 100

s.bind(p) # receiver needs to bind ip and port

i=1
while i<12:
rec_data = s.recvfrom(buffer_size)
print rec_data[0]

print "connection closed"
s.close()

21 changes: 21 additions & 0 deletions udp/udps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/python2


# senders code

import socket
import commands

ip = "127.0.0.1" # this is ip of receiver
port = 9090 # recv port

recv_sock = (ip,port)

s=socket.socket(socket.AF_INET,socket.SOCK_DGRAM)

i=1
while i<12:
msg = raw_input("enter your msg")
s.sendto(msg,recv_sock)
i+=1
print " connection ended"

0 comments on commit 257ee2e

Please sign in to comment.