Saturday, March 28, 2020

How to perform automatic task by using python coding

How to perform automatic task by using python coding


PyAutoGUI 

in python, we use pyautogui module to perform automatic work

1: first we install module "pip3 install PyAutoGUI"for Linux user
2:if your window user then you type"pip install PyAutoGUI"

3:secod we find the screen cursor position  with
           currentMouseX, currentMouseY = pyautogui.position() # Get the XY position of the mouse.

4: for moving the cursor
pyautogui.moveTo(100, 150) # Move the mouse to XY coordinates
5: for click perform tast
pyautogui.click()          # Click the mouse.

source code:


import pyautogui as py,time
import webbrowser
time.sleep(5)

for i in range(20):
    time.sleep(12)
    #print(py.position())
    py.click(352 ,55)
    py.typewrite(" Adrees umer")
    time.sleep(7)
    py.typewrite(["enter"])

How to creat a live pentration tool for port scanning and ip finding using pyton programming

Making Your Port Scanner


port scanning is a method in which we can assess which of ports is open and which is the ports is closed
A port scanner allow you to look at the hosts and services that are attached to them. 

source code:

import socket
from datetime import datetime
target=input("Enter the target:")
print("_*"*60)
ip=socket.gethostbyname(target)
print(ip)
t1=datetime.now()
    
for port in range(1,500):
        
    sock=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
    result=sock.connect_ex((ip,port))
    if result==0:
        
        print(f"port open:{port}")
    
    sock.close()
t2=datetime.now()
print(f"time{t2-t1}")
       
    
--------------------------------------------------------------------------------------------------------


Python Happy Birthday Program

import turtle from random import randint , choice width = 700 height = 500 S = turtle . Screen () S . setup ( width , height ) S . bg...