create_actor

Started by habi, Apr 28, 2020, 08:04 PM

Previous topic - Next topic

habi

#15
i was making a video the whole day. https://youtu.be/bVWGU4Ph6Fs
it's about setting up python, scapy etc etc

QuoteUnfortunately, no. I don't really understand how this works
@DMWarrior
Well, the packet data is an array. length is about 30, but can be more.

Actually the length is some 90 because,
first 20----- storing machine ids of source, machine id of destination etc etc
second 20.----ip address of source, destination,
third 20----source port destination port
last 30-----Raknet data---this is what we want.
also 20+ 20+ 20+ 30 = 90

So the array. each element of array is an integer between 0 and 255, which is represented by ff bf ae etc in packet capturing softwares.

I will post some image of it sometimes later.

MEGAMIND

hey that nodejs thing is really cool i did lots of stuff this night, btw i would like to know why are the pings of bot soooo high like they range from 30000 to almost like 50000, is there a solution to it(Would be helpfull)

habi

#17
Quote from: MEGAMIND on May 01, 2020, 11:02 PMhey that nodejs thing is really cool i did lots of stuff this night, btw i would like to know why are the pings of bot soooo high like they range from 30000 to almost like 50000, is there a solution to it(Would be helpfull)
I had noticed it and thought about reducing it.
Every two seconds or so, the server sends a ping packet to client. the packet contain a timestamp. client receives it and sends another packet called pong. this packet contain the old timestamp.
when it reaches server the server subtract the current time with the time it send old packet with the timestamp shown in pong packet. usually it is 300 or 400.
But in our case, we are replaying, the timestamp of pong packets of client are those when we recorded it.
we couldn't get a live timestamp from server.

hence the ping shown is very high. but actually it is not so.

if you want to reduce it, we must sniff the server packet, find it's data like timestamp and inject this to our recorded packets.

It goes like that..

umar4911

@habi
not used to python. Here is an error popped on creating actor.

Exception in thread Thread-2:
Traceback (most recent call last):
  File "C:\Users\Umar\AppData\Local\Programs\Python\Python38-32\lib\site-packages\scapy-git_archive.devd9fbc7240b-py3.8.egg\scapy\arch\windows\__init__.py", line 693, in dev_from_name
    return next(iface for iface in six.itervalues(self)
StopIteration

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Umar\AppData\Local\Programs\Python\Python38-32\lib\site-packages\scapy-git_archive.devd9fbc7240b-py3.8.egg\scapy\arch\windows\__init__.py", line 772, in pcapname
    return IFACES.dev_from_name(dev).pcap_name
  File "C:\Users\Umar\AppData\Local\Programs\Python\Python38-32\lib\site-packages\scapy-git_archive.devd9fbc7240b-py3.8.egg\scapy\arch\windows\__init__.py", line 696, in dev_from_name
    raise ValueError("Unknown network interface %r" % name)
ValueError: Unknown network interface 'Npcap Loopback Adapter'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Umar\AppData\Local\Programs\Python\Python38-32\lib\site-packages\scapy-git_archive.devd9fbc7240b-py3.8.egg\scapy\arch\windows\__init__.py", line 701, in dev_from_pcapname
    return next(iface for iface in six.itervalues(self)
StopIteration

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Umar\AppData\Local\Programs\Python\Python38-32\lib\threading.py", line 932, in _bootstrap_inner
    self.run()
  File "C:\Users\Umar\AppData\Local\Programs\Python\Python38-32\lib\threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "E:\vcmp\sqmod\movie server\Actor script\scripts\main.py", line 228, in create_actor
    send(p, verbose=True,iface=interface);
  File "C:\Users\Umar\AppData\Local\Programs\Python\Python38-32\lib\site-packages\scapy-git_archive.devd9fbc7240b-py3.8.egg\scapy\sendrecv.py", line 345, in send
    socket = socket or conf.L3socket(*args, **kargs)
  File "C:\Users\Umar\AppData\Local\Programs\Python\Python38-32\lib\site-packages\scapy-git_archive.devd9fbc7240b-py3.8.egg\scapy\arch\pcapdnet.py", line 332, in __init__
    self.ins = open_pcap(iface, MTU, self.promisc, 100,
  File "C:\Users\Umar\AppData\Local\Programs\Python\Python38-32\lib\site-packages\scapy-git_archive.devd9fbc7240b-py3.8.egg\scapy\arch\windows\__init__.py", line 799, in open_pcap
    iface_pcap_name = pcapname(iface)
  File "C:\Users\Umar\AppData\Local\Programs\Python\Python38-32\lib\site-packages\scapy-git_archive.devd9fbc7240b-py3.8.egg\scapy\arch\windows\__init__.py", line 774, in pcapname
    return IFACES.dev_from_pcapname(dev).pcap_name
  File "C:\Users\Umar\AppData\Local\Programs\Python\Python38-32\lib\site-packages\scapy-git_archive.devd9fbc7240b-py3.8.egg\scapy\arch\windows\__init__.py", line 704, in dev_from_pcapname
    raise ValueError("Unknown pypcap network interface %r" % pcap_name)
ValueError: Unknown pypcap network interface 'Npcap Loopback Adapter'
Have npcap installed and socket connection was successfull too
RT Member | Asian City Scripter | CTB Contributor | VKs Contributor | European City Contributor | EAD Scripter

habi

hi umar, i am happy that you are using this.

open cmd, type scapy
scapy will open up
then enter this command
conf.auto_crop_tables=False; IFACES;


Look for name something containing 'Loopback'.  In the image it is Software Loopback Interface 1

Copy its entire name. This is your correct interface name.

Now, open main.py change12th line
interface='Software Loopback Interface 1'
( # is used for commenting in python )

let me know if it works.

umar4911

Quote from: habi on May 03, 2020, 03:19 PMhi umar, i am happy that you are using this.

open cmd, type scapy
scapy will open up
then enter this command
conf.auto_crop_tables=False; IFACES;


Look for name something containing 'Loopback'.  In the image it is Software Loopback Interface 1

Copy its entire name. This is your correct interface name.

Now, open main.py change12th line
interface='Software Loopback Interface 1'
( # is used for commenting in python )

let me know if it works.
connection successful but the issue is the player didn't connect to the server, printing player as null
AN ERROR HAS OCCURED [the index 'ID' does not exist]

CALLSTACK
*FUNCTION [onBotCommand()] scripts/actor.nut line [25]
*FUNCTION [dR()] scripts/actor.nut line [8]

LOCALS
[player] NULL
[skin] 0
[botID] 0
[name] "tommy"
[params] ARRAY
[i] 5
[text] "tommy 0 0"
[cmd] "created"
[this] TABLE
[text] "tommy 0 0"
[cmd] "created"
[i] 7
[data] "created tommy 0 0"
[this] TABLE

python printed sent 1 packets
RT Member | Asian City Scripter | CTB Contributor | VKs Contributor | European City Contributor | EAD Scripter

habi

1. Is your server running on port 8192?
What was the interface name you found?

umar4911

Quote from: habi on May 04, 2020, 04:15 AM1. Is your server running on port 8192?
What was the interface name you found?
was using port 8194. Changed to 8192 and worked.
RT Member | Asian City Scripter | CTB Contributor | VKs Contributor | European City Contributor | EAD Scripter

MEGAMIND

#23
hey everyone...! ive been playing with nodejs npcs, lel they are awsome, ive tested them with almost many minigames and side game in my server, made them do lots of stupid an funny stuff, but the thing is at alomost 3-4 npcs the server gets crashed after each bot has done its task, why does it happen

habi

#24
Quote from: MEGAMIND on May 04, 2020, 04:20 PM.....but the thing is at alomost 3-4 npcs the server gets crashed after each bot has done its task, why does it happen
on blank server?

MEGAMIND

Quote from: habi on May 04, 2020, 05:06 PM
Quote from: MEGAMIND on May 04, 2020, 04:20 PM.....but the thing is at alomost 3-4 npcs the server gets crashed after each bot has done its task, why does it happen
on blank server?
on TDCS server, blank would obviously make no issues but what if people adapt this method on there server so there server will get crashed in an hour/after an hour

KX

Quote from: MEGAMIND on May 04, 2020, 06:31 PM
Quote from: habi on May 04, 2020, 05:06 PM
Quote from: MEGAMIND on May 04, 2020, 04:20 PM.....but the thing is at alomost 3-4 npcs the server gets crashed after each bot has done its task, why does it happen
on blank server?
on TDCS server, blank would obviously make no issues but what if people adapt this method on there server so there server will get crashed in an hour/after an hour

If working on blank script then something is wrong with your script or you are doing something wrong.

MEGAMIND

Quote from: KX on May 05, 2020, 02:07 AM
Quote from: MEGAMIND on May 04, 2020, 06:31 PM
Quote from: habi on May 04, 2020, 05:06 PM
Quote from: MEGAMIND on May 04, 2020, 04:20 PM.....but the thing is at alomost 3-4 npcs the server gets crashed after each bot has done its task, why does it happen
on blank server?
on TDCS server, blank would obviously make no issues but what if people adapt this method on there server so there server will get crashed in an hour/after an hour

If working on blank script then something is wrong with your script or you are doing something wrong.
pff my script is all okay + its a nodejs which means its a player connection from an other localhost theres no relation of script in it.. kindly dont interfair when u dont have knowledge about packets

habi

Megamind, there is something else.
Remember, we are sending recorded packets and if the server asks for something ( with the player pointer ), we are not giving answers. so it will crash. You have to start with blank script.

MEGAMIND

#29
Quote from: habi on May 05, 2020, 11:17 AMMegamind, there is something else.
Remember, we are sending recorded packets and if the server asks for something ( with the player pointer ), we are not giving answers. so it will crash. You have to start with blank script.
hey habi.. nice to see you, no actually its all okay nothing goes wrong it all happens after 5 hours or 6 hours, well i see that nodejs bots when recorded and played the just do that work for once, so to make them loop over i made small script in batch.bat file something like this which makes bots reconnect to server and loop over again and again, its something like this

start.bat:a
start play.bat
Timeout /T 180 /nobreak >nul
taskkill /F /fi "WINDOWTITLE eq vcmpbots*"
taskkill /F /IM node.exe
Timeout /T 12 /nobreak >nul
goto a

play.battitle vcmpbots
start /B node play.js Hunter_Bot
start /B node play.js Tank_Bot
, well i had to adapt this method for my bots to reconnect as they should loop by themselves but they were not doing like it, so i created these bat files to do the work, well if there is an alternate to it! i mean if the bots loops by itself let me know how and when does it doo that after how many intervals of time, if it doesnt loop by its self so i think bat files arent an issue, well ill try it on a blank server as well, but to be honest TDCS is all okay and theres no such issue why..? bcz nodejs are just like a normal player connecting again and again...