Coders Packet

User's Detail Bot in Python

By Shubham Menroy

An automated bot in python that mails the user detail(like IP, Username, and mac address) who deployed your software in his/her system.

Hi, Today we are learning how to build an automated detail mail using python. The motive of this bot to get the user info who is using software which was built by you. 

So let's understand the working and pseudo code of this bot. This application/bot requires 3 packages UUID, socket, and SMTP.

UUID  is a package that is used to generate a unique random object as ids of 128 bits. 

The socket is a package that is used to establish the connection between nodes on a network to communicate.

SMTP(Simple Mail Transfer Protocol) is a protocol that is used to send an e-mail or handle e-mail routing between users and servers.

In this project, we are using the UUID package to get the user's mac address by writing a code snippet.

(':'.join(['{:02x}'.format((uuid.getnode()>>i) & 0xff) for i in range(0,8*6,8)][::-1]))

The socket library is used in this project to get the user's Username and IP by using some modules of it.

_username = socket.gethostname()# For geting User's Divce username
ip=socket.gethostbyname(_username)# for getting user's IPV4

As we already knew that SMTP library is used for email routing or email sending so this library is used for sending details of the user through e-mail to the software developer.

Now copy the given below code and use this code in your own software which is developed in python.

import uuid
import socket
import smtplib

def mail_info():
    _mail="[email protected]"#replace it with your email.
    _password = "Password"  # replace it with your email password.
    _username = socket.gethostname()
    _receiver_email='[email protected]'
        _msg=_msg+'User Name: {}\nIP Address: {}\nMac Address: '.format(_username,ip)
        _msg=_msg+(':'.join(['{:02x}'.format((uuid.getnode()>>i) & 0xff) for i in range(0,8*6,8)][::-1]))
        _msg='subject: Software Deployed \n {}'.format(_msg)
        for wr in _receiver_email:
if __name__=="__main__":


Download project

Reviews Report

Submitted by Shubham Menroy (shubham9672)

Download packets of source code on Coders Packet