Showing posts with label Coding. Show all posts
Showing posts with label Coding. Show all posts

Scheduled Skype Message in Python

To send a message on Skype at a scheduled time, you can use the schedule library in Python along with the skype4py library to interact with the Skype API. Here is an example of how you can schedule a message to be sent on Skype:

import schedule import time import skype4py def send_message(): # Create a new Skype object skype = skype4py.Skype() # Connect to the Skype API skype.Attach() # Send the message to the desired recipient skype.SendMessage("skype_username", "Hello, this is a scheduled message.") # Schedule the send_message function to run at a specific time schedule.every().day.at("22:30").do(send_message) while True: schedule.run_pending() time.sleep(1)

This code will send a message "Hello, this is a scheduled message." to the skype user 'skype_username' every day at 22:30. You can change the schedule time and message as per your requirements.

Note: In order to use this code, you need to have skype4py library installed in your system. you can install it via pip by running pip install skype4py in your command prompt.

Python Scapy and its uses.

Python Scapy is a powerful packet manipulation tool that allows users to send, sniff, dissect, and forge network packets. It is written in Python and can be used for a wide range of purposes, including network security and testing, packet capture and analysis, and network protocol development.

One of the primary uses of Scapy is network security testing. It allows users to create and send custom packets over the network, sniff and analyze packets, and perform various types of scans and tests to identify vulnerabilities and potential security threats. Scapy can be used to perform tasks such as port scanning, network discovery, and vulnerability assessment, as well as more advanced tasks such as packet injection and spoofing.

In addition to security testing, Scapy is also commonly used for packet capture and analysis. It provides a rich set of functions and classes that allow users to dissect packets and extract specific fields and payloads. This can be useful for tasks such as analyzing traffic patterns, troubleshooting network issues, and developing new network protocols.

Scapy is also often used for network protocol development. It allows users to craft custom packets and send them over the network, which can be useful for testing and debugging new protocols. Scapy includes a powerful command-line interface that allows users to interact with the tool using simple commands and scripts, making it easy to automate tasks and create custom tools and applications.

Despite its many useful features, it is important to note that Scapy can also be used to launch various types of attacks on networks and systems. These attacks can include Denial of Service (DoS) attacks, Man-in-the-middle (MitM) attacks, and password cracking attacks, among others. It is important to use Scapy (and any other tool) responsibly and only for legitimate purposes in a controlled and authorized environment. Unauthorized attacks are illegal and can result in serious consequences.

Overall, Python Scapy is a powerful and versatile tool that can be used for a wide range of purposes related to network security and protocol development. Its rich set of features and easy-to-use interface make it a popular choice among network professionals, security researchers, and developers. However, it is important to use Scapy responsibly and only for legitimate purposes in order to avoid any legal or ethical issues.

Decode Base64 and ROT13 in Linux Terminal

Below are the commands , to Decode and Encoded text from Base64 and Rot13.
It is a handy and easy technique required in CTFs. Alternatively we can also google and use any website offering decoding of text from these two types. But in terminal we can decode it quickly and save our precious time.

From Base64 we use the function base64 and option -d (for decode).

$ base64 -d data.txt


From ROT13 (also called as rotated 13 times) we use the function tr (for translation). the text must be echo first and piped into tr with two strings as arguments.

$ echo " GUR CNFFJBEQ VF 5GR8L4QETPESPK8HTQJHRK8XSP6X2RHH" |tr '[A-Za-z]' '[N-ZA-Mn-za-m]'




-574r570rm

Wordpress Username Enumeration

 In Wordpress we can do a username enumeration in several ways. We can do it via Metasploit or Nmap NSE Script. But if both of these are not available or we want to use another simpler method, here is one mentioned below.

A Bash Script to enumerate Wordpress usernames.

Copy the below Bash code text into a .sh file.
Change the website to URL to your desired URL.
Change the range of user ids default is 1 to 20.
Then chmod the file to make it executable ( chmod +x filename.sh)(in linux terminal)
and run ./filename.sh.


BASH Code:

 for i in {1..20}; do curl -s -L -i http://www.your-desired-website/?author=$i | grep -E -o "\" title=\"View all posts by [a-z0-9A-Z\-\.]*|Location:.*" | sed 's/\// /g' | cut -f 6 -d ' ' | grep -v "^$"; done





CYB3RTR0N , 574r570rm

Basic python program in linux to see if a port is open

Below is a simple python program in linux to see if a port is open or close.

#!/usr/bin/python
import socket
ip = raw_input("Enter the IP Address: ")
port = input("Enter the Port Number: ")
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
if sock.connect_ex((ip,port)):
        print "Port",port, "is closed"
else:
        print "Port",port, "is open"




We will use which python.py to know about the location of python, so we can use it in hash bang.
next we are importing the socket library.
taking as input and port are self explanatory.
SOCKET constants and functions are used to get socket connected to sock variable.
connect_ex will throw an exception if the port is closed , and we are utilizing it to display "the port is closed"
else it will be open.

make it executable and run,...

I am not going into details, as there are many tutorials out there to learn the basics.

CYB3RTR0N

Bash program to find active ips

I am learning Ethical hacking and penetration testing these days, and thought to write something in blog so that it can be helpful for others.

So today i learned how to write a bash program to find active ips on your network.

here is the program, i will explain it below.

#!/bin/bash
if [ "$1" == "" ]
then
echo "Usage: ./ping.sh [network]"
echo "Example: ./ping.sh 192.168.1"
else
for x in {1..254} ; do
ping -c 1 $1.$x |grep "64 bytes"|cut -d" " -f4|sed 's/.$//'
done
fi

I won't go into the complete details , instead i am writing out only the problems i faced.

  1. first is the if command syntax , there is a space after if [ , it will give error if you write without space if[ 
  2. The seq command somehow didn't worked for me, (i am using ubuntu 17), so i used {1..254}, this command will let the variable take one value at a time from 1 to 254
  3. semi colon after the range is defined.
  4. must use a space after sed command i.e. sed 's/....'

That is all , it worked fine for me in ubuntu. striping the text that is not important to me and only showing me the ip addresses that are active in a given network.




CYB3RTR0N

🚀 GRC in Action: Connecting Theory to Reality 🚀

  As part of my GRC studies with Inegben Academy, I'm applying the OCEG Red Book framework to real-world challenges. 1. Third Party Risk...