half bots

Started by habi, Apr 16, 2020, 01:59 PM

Previous topic - Next topic

habi

Today i will show how to have a kind of bots in your server.

First you go to server and 'record' actions for say 5 minutes. I will tell how to 'record'.
Then you play it. the same things happen in server.

1. You need wireshark https://www.wireshark.org/#download
2. You need python ( mine is not 3 , it is 2.x )
3. Scapy https://scapy.readthedocs.io/en/latest/installation.html

You are going to connect to a server ( do not connect to 127.0.0.1:8192 but something else )
Now, open wireshark and select interface ( mine is Wi-Fi )
Then it will start recording packets. All you need is open VCMP Browser. Select your server play on it for some time.
Then come back to wireshark and stop. Then save the packets in *.pcap extension. eg. play.pcap

Now you can play it in two ways. 1. Colasoft Packet Player https://www.colasoft.com/packet_player/ which is the software i started with. But you do not need it, since i made a python code to manually play the packets. So here 2. Using python and scapy to play it. Edit the python file below and change ip address, name, etc. Place your pcap file and python file in same folder and run the python file. You will see a new player appearing in your server.

#!/usr/bin/env python3
# importing the threading module
import threading
from scapy.all import *
from scapy.utils import rdpcap
import time
import sys

if __name__ == "__main__":
   
    name = "hh17"# 4 letter   
    old_name = "habi"
    a=rdpcap("second.pcap")
    i=0;
    for b in a:
        m=0;
        if hasattr(b, 'load'):
                if b.load.find(bytes(old_name.encode())) >=0:
                    b.load=b.load.replace(bytes(old_name.encode()),bytes(name.encode()))       
        if(UDP in b):
            del b[UDP].chksum
            del b[UDP].len
        if(Ether in b and IP in b and UDP in b):
            send(IP(dst="127.0.0.1")/b[UDP], verbose=True,iface='Npcap Loopback Adapter');
        if(i<len(a)-1):
            m= float( a[i+1].time - a[i].time );
        time.sleep(m);
        i=i+1;

NicusorN5

Nice! Thanks! This is going to be usefull for emptier roleplay servers!

Eva

cool, you could make a taxi or bus drive routes and stop at the bus/taxi stops :P

habi

#3
Eva, there are some problems also. idk if we can enter the bus/taxi. because when we recorded, the passenger was not there. but i will give a try.

habi

#4
hi everyone, I was digging this for a week.
Think of something like create_actor
yeah. I have made it exactly. will create a topic and post codes later.

NicusorN5

Quote from: habi on Apr 28, 2020, 04:37 PMhi everyone, I was digging this for a week.
Think of something like create_actor
yeah. I have made it exactly. will create a topic and post codes later.
Hey actually this is a great idea!
I can try making a bot plugin, but idk how to expose the squirreil funcs.