#networks

1 messages Β· Page 47 of 1

elder cobalt
#

Ah I see, thanks for clarifying

#

Was thinking if I could refit some parts of your code in mine (basically the modded server part only) but guess it'll take a bit more time to understand first lol

#

Thanks

cloud spruce
cloud spruce
#

@elder cobalt just wondering of the code works or not
after working on it so long it would be fun to know as i couldn't test it for real πŸ˜†

elder cobalt
cloud spruce
odd gull
#

Hi everyone

#

i have a problem with my dns can i ask my question here? (i mean is it the right channel xd)

cloud spruce
odd gull
#

Alright ... so i have a problem with my dns when i connect to a specific wifi (lets call it wifi-x)
My dns works fine when i connect to another wifi and the dns of other machines works also fine when they connect to that (wifi-x)
I'm using kali linux ... i really tried all the solutions i found on the internet but nothing changed πŸ€·β€β™‚οΈ
Any ideas of what causes this problem?

restive blaze
#

IIS can only handle HTTP. They have a Network Load Balancer for layer 4

cloud spruce
# elder cobalt πŸ™ thanks alot

i'll leave a shorter version here for you as well: https://paste.pythondiscord.com/zarirujehu.py
it's without any of the mocking and a little bit less debug output available at high verbosity levels
the line if __name__ == "__main__": and after is just for handling command line arguments
and gathering some variables and values for the script, besides kicking of the main() function

#

you are overwriting the conv2hex variable over and over again in the loop
conv2hex will only contain the hex encoded equivalent of the last element of wordlist

#

!e

wordlist = ["POST", "scripts", "Plugin"]

for x in wordlist:
    conv2hex = x.encode("utf-8").hex()

print(bytes.fromhex(conv2hex).decode('utf-8'))
errant bayBOT
#

@cloud spruce :white_check_mark: Your eval job has completed with return code 0.

Plugin
cloud spruce
#

later in if conv2hex in data.hex(): you also only check against one string
you need another kind of construct here too

elder cobalt
#

I might be increasing the world list so I think it'll be convenient if i could just add in words in the word list and it'll convert them to hex automatically and check the data stream if it matches to anything from my wordlist

cloud spruce
# elder cobalt Hello, just returned back from exam, wanted to know how would it be possible to ...

i'm hoping your exam went well
converting the payload of every packet to hex is quite wasteful, even making a bytearray of every packets payload is probably unnecessary
i think you should rather just convert each element in the search list to bytes and then prepare them for efficient searching, then using that to search the bytes of the payload of each packet
there are numerous algorithms you could use for the efficient searching for the different terms
are you interested to know how many of the words matched and where in the payload or just the first match and which it was or even just that one of the words matched and no regards to which it was and where in the payload?

cloud spruce
elder cobalt
cloud spruce
elder cobalt
# cloud spruce aha, the game client just uses http? 🀦 πŸ˜†

Yeah the game sends http packets at first requesting for server info like time, players online and etc. After that the server responds back with it but when I'm loading in-game right before it finishes loading in fully it'll load these scripts. After that it switches to sending UDP packets

#

Unfortunately there's no way for me to disable it other than doing it with packets

elder cobalt
#

Hello @cloud spruce would this be efficient?

wordlist = bytes[b"POST", b"scripts", b"Plugin"]
filter = True

with pydivert.WinDivert("ip.DstAddr = 147.135.137.85 && tcp.PayloadLength > 50") as w:
    for packet in w:
         data = bytearray(packet.payload)
         if filter and (wordlist[0] in data or wordlist[1] in data or wordlist[2] in data):
            print("Condition met")
            w.send(packet)
         else:
            w.send(packet)
elder cobalt
#

Also update on the script which you've sent, I sometimes receive really strange values like these @cloud spruce

#

problem is that I really don't know how to filter out those values, I was thinking if we could maybe filter values if they dont make sense and just reuse the value previous XYZ value? but sometimes car's can teleport to other spawn positions so the XYZ position difference could be too huge there as well

#

oh hmm

#

updates come in very rarely

#

when searching up other sessionIDs

#

basically it works well for some sessionIDs but not for all πŸ€”

elder cobalt
#

I'm still surprised tho how the game client can still understand what sessionIDs those packets belong to

elder cobalt
#

Man it definitely is frustrating

#

It works so well for some sessionIDs but it does not for others

fervent thorn
#

Is there a way to have N servers connected to each other where each server acts like a client for other N-1 servers.

cloud spruce
cloud spruce
elder cobalt
#

I've just found out something

fervent thorn
#

I want to keep things simple

#

So that in whatever order and at whatever timeframe we start our servers, they should get connected the way I want to

cloud spruce
fervent thorn
#

I have even started implementimg such thing for 2 servers but I'm facing a weird issue

cloud spruce
fervent thorn
#

I posted it here

fervent thorn
#

I suggest you to read the question on stackoverflow

#

You'll understand my problem better

elder cobalt
# cloud spruce yeah?

Remember how the server sends velocity in those packets as well? I've kept digging around because sometimes some packets don't contain the sessionID I want. But somehow the game manages to get position of the cars picture perfect.

Discussed with someone and he said that there was a reason behind the game sending velocity values and that it's because the game uses it to predict the car's position with velocity packets but when I asked whether if let's say the client sends a XYZ position and velocity packet, will the client still keep predicting or use the new packet which it has received and maybe smoothen out the values so that it does not look like the car teleported but unfortunately no clue about that

cloud spruce
# fervent thorn You'll understand my problem better

i did, but i also see it's c++ and not python, it's been many years since i read (not to mention wrote) any c/c++ at all and i'm pretty rusty at it now
and i don't understand how sniffing comes in to the picture (referenced in your question)

cloud spruce
elder cobalt
fervent thorn
#

Main thing is I'm calling connect() inside the loop continuously until it connects....

#

And it's non blocking mode

cloud spruce
fervent thorn
#

So my guess is that when connect runs for the first time, bcz of non blocking code doesn't wait but connect() starts doing it's job. And by the time it calls connect() again, the server is already connected so maybe that's why the error?

cloud spruce
elder cobalt
# cloud spruce i would think so as well, at least for all the other cars and i don't see any ac...

what I've realised after a few hours in game is that when I spectate other people and they click disconnect the game shows the car's still moving but in one single direction and let's say if the car's approaching a wall or something like that the car goes through the wall (suddenly losing it's collision) and then disappear into thin air later with a message saying so and so client disconnected

cloud spruce
elder cobalt
#

oh yeah

#

iirc server sends ping packets as well?

elder cobalt
#

maybe if ping exceeds 600ms

cloud spruce
elder cobalt
cloud spruce
elder cobalt
#

hmm can we predict with the velocity field itself?

#

because if a car stops sending in packets and we were to predict the next position, he could've either increased/decreased his velocity

cloud spruce
elder cobalt
#

can confirm it ingame as well

#
{
    Vector3 PredictedPosition = CurrentPosition + CurrentVelocity * PredictionTime;
    return PredictedPosition;
}

apparently unity uses this function to predict movements

cloud spruce
# elder cobalt its 1ms

good that it's something sensible
but you probably won't get any more updates if the client just disconnects

elder cobalt
cloud spruce
elder cobalt
cloud spruce
# elder cobalt yeah found it

then you need to keep track of time in your code and act on that as well to take care of the case where there are no more updates from the session you are tracking

fervent thorn
#

Oooo fixed my error

#

By calling connect() only when connection is not there. And i checked status of connection by sending data

elder cobalt
#

Oh wait multiplying it by seconds will be a bad idea

#

If my position was X 1000, and velocity was X 15 and multiplying it by 2 it would be 2030 which is very wrong

cloud spruce
cloud spruce
#

order of operations are very important πŸ™‚

fervent thorn
#

Hellooo brother

fervent thorn
#

Sooo intially my sniffer sockets were using inadd_any

#

I've 2 sniffers

#

Both were receiving all the packets of local ips

#

But to test some logic I wanted only one of them to receive test packets

#

So i bound one of them specifically to a local ip say 127.0.0.1 instead of inaddr_any

#

But even now I'm receiving all the packets on both the sniffer

#

Whereas second one should receive only for its destination ip

#

I tried this with 2 of my local ip addresses but same issue

#

Looks like inaddr_any is functioning even when I've bound to a specific ip

#

Sorry ignore

#

I forgot to comment the inadd_any line😭

polar sleet
#

Is requests a safe library

ember ledge
#

Yes.

polar sleet
#

Ok thanks

elder cobalt
cloud spruce
#

we store the data already, but we would need to store som more data too and do som extra checks
also, what action do you want to take when the ping for the target is higher then a set threshold or it has been too long since we saw an update for the target session?

elder cobalt
#

And break from monitoring that sessionID?

#

That way the user can fine tune it

#

Good news it looks like we need to only predict with velocity and acceleration don't need to take gas, steerangle and those into consideration

cloud spruce
elder cobalt
#

When I assigned the velocity of my client to copy that of the target it became smooth

elder cobalt
#

After a few seconds we can set the velocity back to 0 or just stop assigning values to our velocity

cloud spruce
elder cobalt
#

Yeah mb, don't want the car to keep rolling if a car disconnects or the ping is too high lol

cloud spruce
elder cobalt
#

Hmm that might explain why those cars noclip through walls when my internet dies out or their ping exceeded a certain threshold, maybe at the time of their last packet they might've been somewhere else but because of how our games predicting in our screen it will show the car's going through walls until it notices something went wrong and the car's dissapear

cloud spruce
#

to be able to do this and time out the target as well as doing predictions for updates we would need to do a few more things with the code

elder cobalt
#

This will also explain another thing I was messing around one time with velocity packets, iirc the game was predicting collisions between two cars with velocity so I decided to put my velocity to a huge value to see what happens (whether the game crashes or it'll actually send the person to orbit) when I assigned the same position but +1000 of velocity difference between the actual target car speed and how much I've want I found out that my car kept teleporting way off from the person

#

So I did a small hack and decided to fine tune position offset values so that when I teleport to a player it'll teleport into them instead of somewhere else on the map and this did work but it was unreliable most likely because of how I didn't take ping into account

cloud spruce
elder cobalt
#

I load up another game client to monitor

#

No other way πŸ˜…

cloud spruce
cloud spruce
elder cobalt
#

The --no-teleport parameter is useful at such instances lol

cloud spruce
cunning hazel
#

Hey guys, I have a small seemingly basic question related to networking

I am trying to find the latency between my friend's PC and the raspberry pi I have at my hand. While both of us could SSH into my raspberry pi, neither could use the ping command using the public ip address in Windows Powershell as it gives us the timeout error:

ping 121.160.xxx.xxx
Pinging 121.160.xxx.xxx with 32 bytes of data:
Request timed out.
Ping statistics for 121.160.xxx.xxx:
Packets: Sent = 4, Received = 0, Lost = 4 (100% loss)

Anyone can explain me why?
And if so, how could I fix this problem?

honest pasture
#

Windows? tracert <ip>
Linux? apt install traceroute and use traceroute <ip>

cunning hazel
#

Thanks
tracert works, but I believe it's pinging to the router, not the raspberry pi

#

Used the tracerp 121.160.xxx.xxx command

I did port forward the raspberry pi to say port 8000, but using the tracert 121.160.xxx.xxx:8000 doesn't seem to work

honest pasture
#

It's showing you the hops between the device you're doing it from, and the endpoint.

#

So it'll go through your network, out your ISP, across the interwebs, to wherever you pointed.

cunning hazel
#

Errrr
Not sure what you mean by that

By "hopping between devices", you mean it pings to each every device connected to the router?

#

Sorry, I am not familiar with this whole networking thing πŸ˜…

honest pasture
cunning hazel
#

Oh thank you very much

honest pasture
#

Trying using tracert 8.8.8.8 for example. You'll see the hops and latency between you and Google's DNS server.

cunning hazel
#

Thank you so much @honest pasture
I watched the video and understood trace route alot better

However, I can not be sure as to what ip address should I put in the tracert command.
The aformention ip address of 121.160.xxx.xxx is the public ip address of the router, not the raspberry pi. What should I input if I wanted to ping specifically to the raspberry pi?

honest pasture
#

Aren't you trying to determine the latency between you and your pal?
If so, you need to tracert to their WAN IP

#

And their router, which is the gateway for their network should be set to respond to ICMP (ping) packets for tracert to work (I think)

cunning hazel
#

Yes, but wouldn't it be better to find the latency directly from the raspberry pi? Or would that not be feasible/doable?

keen lily
#

reminder that tracing routes over public internet is spotty at best, many ISP firewalls do not allow it. Not saying to not use it, just understand it is inconsistent unless you control all interfaces on the selected path that you are tracing

honest pasture
honest pasture
cunning hazel
#

Hm

honest pasture
#

So SSH to your pi and do it from there.

cunning hazel
#

I suppose

#

Thank you very much

keen lily
cunning hazel
#

Yeah

#

Thanks yall

#

Helped me out a lot

cunning hazel
#

Wow...

#

I live in South Korea, and my buddy lived in Georgia, USA

We tried this tracert command and found out that the delay is more than 1500ms

#

This is a problem because my raspberry pi is used to control a robot. Controlling a robot with more than a full second of delay is painful

#

One hop in particular took up 644ms, traveling from Chicago to Seoul

#

well, now I will never complain about those emails or confirmation messages taking a while to reach to me

cloud spruce
# cunning hazel well, now I will never complain about those emails or confirmation messages taki...

you can't really measure latency with traceroute/tracert, especially not for hops in between
answering traffic destined to the router itself or for TTL timeouts is of the lowest priority for a router and it can even skip it if it has to much other stuff to do
such traffic also hits the control plane of the router, while routing traffic is done directly in the high speed network chips (ASICs and FPGAs) used for the data plane

to get real measurements you need to measure between the two endpoints using another mechanism like dedicated software or the tcp acknowledgement from a service (but not between the two first packets, as the server software might add extra latency before it does an accept() on the connection)

cunning hazel
cloud spruce
# cunning hazel What do you recommend for me to download?

i would probably use something like: nmap --system-dns --traceroute -rn -Pn -sS -p 22,80,443 <host-ip-or-dns-name>
-sT or -sV can be used instead of -sS but i think i got a little lower and more consistent timings using -sS then the other variants
in addition to linux and mac, it's also available on windows where you can opt to install the Zenmap GUI as well if you like to use it that way: https://nmap.org/download.html

there are lots of other tools one can use, i just picked the one that i know works on all those platforms and is still well maintained

another method would be to record or at least observe traffic analyze it with something like wireshark which can calculate round trip times
or write a python script (using scapy, dpkt or any of the other libraries) to do something similar, either live or on a prerecorded pcap file
this method is probably more accurate then just probing a few times and could be used to continuously print a min, mean, max and median value per second or such values and even graph them

cloud spruce
# elder cobalt yeah pretty much

looking at the packet data, it got me thinking
if we also copy the timestamp as well as velocity from the target to the observer we should be in sync with the target and not need to predict the new position adjusted for time anymore and just change the x rotation and the relative position as we are already doing, it should just look like we have a bit higher latency, right?

elder cobalt
#

Also sorry for bringing this up very late but someone already reversed the entire implementation of the stock server and made their own

https://github.com/compujuckel/AssettoServer

Not sure if it could help us figuring out some of our problems regarding prediction but could help here and there

GitHub

Custom Assetto Corsa server with focus on freeroam - GitHub - compujuckel/AssettoServer: Custom Assetto Corsa server with focus on freeroam

cloud spruce
cloud spruce
# elder cobalt Also sorry for bringing this up very late but someone already reversed the entir...

i think that can help a lot, because when i was looking at the packets in kaitai i realized that i think the data structure definition file for the modded packets are wrong, and thus we are reading the data misaligned and getting all the data wrong for all the other records but the first in the modded server updates
just check out the data for all the updates other then the first, they are all totally whacked
i'll try something that i suspect might be the fix for that, otherwise i'm going to dig in to the source code from the project you just posted

cloud spruce
#

and i'm beginning to think that it's something wrong with that structure as well, but at least it fixes the other alignment/offset and the data in the other fields for all the other updates in a packet from a modded server

elder cobalt
#

Ouch i see

#

Yeah just realised that as well now

cloud spruce
# elder cobalt Ouch i see

now it looks a lot better in kaitai, and with this change to the code it also fixes the reading of the data and your car shouldn't teleport everywhere anymore:

# Packet structure for messages from server to client
class UpdateIn(ctypes.LittleEndianStructure):
    _pack_ = 1
    _fields_ = [
        ("session_id", ctypes.c_uint8),
        ("pak_sequence_id", ctypes.c_uint8),
        ("timestamp", ctypes.c_uint32),
        ("ping", ctypes.c_uint16),
        ("position", Vector3),
        ("rotation", Vector3),
        ("velocity", Vector3),
        ("tyre_fl", ctypes.c_uint8),
        ("tyre_fr", ctypes.c_uint8),
        ("tyre_rl", ctypes.c_uint8),
        ("tyre_rr", ctypes.c_uint8),
        ("steer_angle", ctypes.c_int8),
        ("wheel_angle", ctypes.c_int8),
        ("engine_rpm", ctypes.c_uint16),
        ("gear", ctypes.c_uint8),
        ("status_flag", ctypes.c_uint32),
        ("gas", ctypes.c_uint8),
        ("performance_delta", ctypes.c_int16),
    ]
```i've added the last two fields in that data structure
elder cobalt
#

Unfortunately I'm at bed (around 2:30am here) will change it and give it a try and report back once I get up

cloud spruce
#

i even had this comment in my code since i trusted the .ksy file for the modded server:

    # We ignore the last two fields "gas" and "normalized_position" from the
    # stock server updates to be able to use the same structure for both
    # stock and modded servers, as these fields are not present in the
    # updates sent from the modded servers.
cloud spruce
#

and it should have said performance_delta (for the packets from the server) instead of normalized_position (which is for packets to the server)
so i guess i messed up that comment a bit

#

adding the fields to the data structure automatically fixes the alignment due to this code that we already have:

    update_record_size: int = ctypes.sizeof(UpdateIn)
```and that i use the variable `update_record_size` everywhere to calculate the alignment and offset
#

i also think you'll get smother tracking of the target if you copy the timestamp by adding the line:

                    observer.timestamp = target.timestamp
```just after these two lines:
```python
                if args.teleport:
                    observer: UpdateOut = UpdateOut.from_buffer(bytearray(packet.payload))
#

and you might copy gas as well with:

                    observer.gas = target.gas
```just before the lines that reads:
```python
                    # convert struct to bytes and update the packet payload
                    packet.payload = bytes(observer)
elder cobalt
#

looks like I guess we don't need to predict stuff πŸ˜…

elder cobalt
#

or we could but I'm not sure

#

since position is optimised in a modded server, if the player is far away it'll send very very few packets but maybe we could implement a small prediction system here

main spruce
#

Anyone have experience with running a UDP socket in the background

#

Currently I have a GUI using Tkinter and basically I'm sending packets via UDP and I want to receive without freezing the gui

#

Setting the socket to nonblocking results in WinError 10035

#

and I tried using after_idle but that didnt work either

steady horizon
#

Use a second thread

cloud spruce
# main spruce Setting the socket to nonblocking results in WinError 10035

yeah, windows has problems dealing with truly nonblocking sockets unfortunately
you have a few alternatives here, the classical solution is to have different threads, one main gui thread
but that doesn't work as good with python due to the GIL as many other languages, but it might be good enough for what you are doing
you could go multi process, but that will be quite a pain with IPC
or go fully async, but that will require you to change quite a bit of code

cloud spruce
glossy dew
#

How can I connect my python flask project to my domain?

cloud spruce
glossy dew
cloud spruce
cloud spruce
glossy dew
#

My hosting is connected to my domain.

cloud spruce
# glossy dew My hosting is connected to my domain.

does the hosting company you use support python?
i think it will be hard to help out without knowing what we are dealing with here, is it a VPS or some other form of hosting?
it all depends very much on the platform
if you don't want to tell us which hosting provider you are using i think you should contact their support for help with how to deploy your stuff on their service

cloud spruce
elder cobalt
# cloud spruce i think those changes should solve a howl lot and the prediction should be done ...

Hmm when I'm not spectating a person and his car is far away I receive his packets less compared to the person nearby, but I haven't tried checking what would happen even with this optimization perhaps my car will appear starting and stopping for the other person, or because now I've teleported to his place because I tricked the game into thinking I'm nearby him it'll start sending his packets like normal or whether it would just predict the path till the next packet is sent

#

I think the second case might happen, since we've tricked the server into thinking we are nearby him it'll start sending more packets of that sessionID to me

cloud spruce
#

one problem though, your client doesn't know that it's located somewhere else according to the server and the other clients πŸ€”

#

hopefully that doesn't complicate matters

elder cobalt
#

That shouldn't be a problem, I can always load another client to see if it's actually working or ask a friend of mine to screenshare what he sees

#

As long as we've tricked the server into thinking we are nearby it should be fine

#

Since the server optimises the packets not the client

#

That means it's pretty much working now with no issues, if possibly could you maybe go through on how this was possible?

#

And thanks alot again as well, took a good week or so to get things fixed but luckily we didn't need to do any type of prediction stuff lol

cloud spruce
cloud spruce
#

but it wasn't in vain, it was pretty fun to build the prediction stuff
i got to build out the previously very small Vector3 class with a lot more code to be able to write very nice code that does math using that class

elder cobalt
#

At first I thought that maybe because the server is reporting wrong values at times maybe we need to predict it

#

But it looks like the offsets were slighty off

#

Fixing that up made things work as expected

cloud spruce
#

the problem was that i trusted the ksy file for the modded packet, i guess the old saying "trust, but verify" applies here πŸ˜†

elder cobalt
#

Yeah my bad didn't look through it properly

cloud spruce
#

and i should have looked at it more before just accepting it as reality, so my bad as well

elder cobalt
#

eh at least we knew it was working and only few fields were off

#

that helped us in rooting to prediction until you brought it up

#

That there was something wrong with the offsets

cloud spruce
#

everything was skewed and wrong for everything but what i would call the header and the first update, which meant we were pretty screwed trying to work with that until that was fixed

#

i should have known by just looking at the values of the second and the following updates as well as marking the last field of the last update for a multi update modded server packet and seeing that it didn't correspond even closely to the end of the data of the network packet

elder cobalt
#

Btw @cloud spruce If I want to implement on how you've managed to get modded server packets to decode on other pieces of code I've made you think it would be better to either refit my code or just adjust things in your code in the way I want?

glossy dew
cloud spruce
#

otherwise it would be quite a lot of code that would need to be transferred over to your code base
as you can see i'm not using from_float and to_float anywhere
i've even removed those functions entirely as they are not needed any more with the new structs which translates all the data types and fields automatically so that they are easier to work with and in a pretty performant way as well

ember ledge
elder cobalt
#

@cloud spruce just a small doubt, if I want to get rid of

def main(args) -> None:

Since I am just going to provide all the variables within visual studio code and change it there, should I just change it to

while True:

or what should I do?

cloud spruce
elder cobalt
elder cobalt
cloud spruce
elder cobalt
#

For verbose

cloud spruce
elder cobalt
elder cobalt
cloud spruce
elder cobalt
fast pier
#

any networking guru... just curious why I have issues w/ internet connectivity when i switch off my always on VPN on my phone. Is it a dns issue? Sometimes certain apps or sites block the VPN so i need to be able to toggle. Using wireguard protocol

cloud spruce
cloud spruce
fast pier
fast pier
#

Wish i knew how to just flash it

cloud spruce
fast pier
ember ledge
#

Can someone help me

#

i was talking to a person who was a hacker.. and he hacked my friend with an infinite loading gif on discord.. she clicked on it and he had her ip. I went to talk (ik foolishness) and we just talk and he sent normal discord gifs.. i didn't click on anything just chatted .. I'm just scared of the gif.. do u think he has my IP? I have a DHCP enabled Ip

elder cobalt
cloud spruce
elder cobalt
ember ledge
fast pier
cloud spruce
elder cobalt
# ember ledge I HAVE DHCP TELL ME ABOUT ME

Well for starters you could just restart your router and say your friend to do the same.

Secondly there's no point in knowing someone's IP address since all the websites you visit know your IP address so it isn't a huge deal apart from knowing where you live and even if they knew that it's going to be very hard to triangulate your actual position.

All I could say is make sure is that if you or your friend have any open ports just make sure to disable and search up a firewall which could filter out those ports just if in case he decides to flood your network otherwise if no open ports nothing much to worry

#

Im really bad when it comes to finding firewalls which can filter out ports but you can follow any guide online

ember ledge
#

So i don't have to worry right? Thank you

#

Thank you so much

elder cobalt
#

Yeah pretty much

#

For safety it's best to just restart routers

ember ledge
#

I have dynamic which means it's changes

cloud spruce
#

yeah, @ember ledge the might know in which city and even which part of the city your and your friend live in, but that should be all
having someones ip address opens up for DoS, but if you connect and reconnect your internet service and you have a dynamic ip you mostly get a new one and that problem should be gone

elder cobalt
ember ledge
#

Thank you guys 😘

elder cobalt
#

No probs just stay safe out there as people sometimes bait you into trying out their new game or something like that lol

cloud spruce
ember ledge
#

Hmmm

#

Are u guys real?

#

Or AI

elder cobalt
#

I doubt an AI will have an anime pfp πŸ˜…

#

and talk with broken English as well

ember ledge
#

Thank you for th help qt

#

You too rndpkt

cloud spruce
ember ledge
#

Mwah

elder cobalt
#

No probs you could go and block + report that person as well as a safety measure

cloud spruce
# cloud spruce if it's a problem for the situation when you are on wifi, you could instead of r...

@fast pier one more thing, the same procedure as for wifi should probably work if you're on mobile data as well
just disconnect from mobile data so that you don't have any internet connection on your phone and then reconnect to mobile data again, it should setup your ip address, default route and dns configuration anew
hopefully everything works after that again until you connect to the vpn and decide to disconnect from the vpn again

elder cobalt
#

Btw @cloud spruce there was one line in the GitHub I've posted saying

steerAngle: byte, -127

I assume it's basically converting that field to a byte and doing -127?

ember ledge
cloud spruce
elder cobalt
#

because when I converted the payload to little-endian unsigned char it went from 0 all the way to 254

cloud spruce
cloud spruce
elder cobalt
#

makes sense now why it's at 254 only

#

I'd expect it to go till 256

cloud spruce
# elder cobalt I'd expect it to go till 256

1 byte = 8 bits, which gives you 256 different combinations, and starting with 0 gives you 255 as the largest number that you can store before it wraps around or give you an error (depending on the language)

#

so it should be able to give you 255 as well, not just 254, but it won't be able to give you 256 as that would need a 9:th bit to store that number

cloud spruce
# elder cobalt I'd expect it to go till 256
0000 0000 = 0
0000 0001 = 1
0000 0011 = 2
0000 0100 = 3
...
0111 1110 = 126
0111 1111 = 127
1000 0000 = 128
1000 0001 = 129
...
1111 1100 = 252
1111 1101 = 253
1111 1110 = 254
1111 1111 = 255
```and then you would be out of bits for a 8 bit (1 byte) unsigned number
```txt
0000 0001 0000 0000 = 256
```with two bytes there would be no problem storing that number regardless of if the data type is signed or unsigned
elder cobalt
#

Oh thanks for the explanation πŸ‘ πŸ™

fast pier
cloud spruce
ember ledge
#

does someone know how I can run a proxy server on my computer and do requests over my computer from a different computer?
I've tried the proxy.py module which didnt let me connect from other computers

cunning garden
iron bison
#

If I enter an unsecured network, how do I know later if my computer is safe?

inland sapphire
#

Hi, I need recommendations on software architecturing. I have a server and a client. The client makes requests to the server and the server responds back with a response. The client is the one that is always initiating the request. However occasionally the server needs to be able to push updates back to the client without the client having initiated anything. How can I acheive this (ideally) without using multithreading? The solution needs to be somewhat scalable (although not too much) and robust and also support sending both binary and text formats.

cloud spruce
cloud spruce
cloud spruce
# inland sapphire Hi, I need recommendations on software architecturing. I have a server and a cli...

i'm guessing you are going to use http/https, or is this architecture open to other solutions as well?
the client, is it a client device running a web browser or other application or another server as in a microservices architecture or similar?
if the client is the only one that should initiate the connections you can't use something like webhooks as a callback mechanism
you'll instead need to rely on a long lived connection from the client to the server, this can be achieved in many different ways
what you should pick is very dependent on your specific situation, application and environment
with more information we can probably give better guidance

inland sapphire
# cloud spruce i'm guessing you are going to use http/https, or is this architecture open to ot...

architecture can be http/https but something over plain old TCP sockets is completely fine as well. I only need it to support text+binary formats (i really dont want to use base64), a message based protocol rather than a stream oriented one (the server and client need to send discrete messages to each other) and the behaviour i mentioned above where although the client initiates a request after having connected to the server occasionally the server should be able to "push" messages to the client without it explicitly requesting them. The client is a terminal CLI no webbrowsers are used so the solution shouldnt make any assumptions about the presence of a webbrowser. Throughout the lifetime of thje session the client should begin the connection initiating it and keep the connection open (long lived) up to the point that it ends its current session where the client itself will make the decision to disconnect. While the connection is open messages are passed between client and server. Scalability isnt too big a concern here but it the solution should be able to handle multiple client concurrently with as little resource usage as possible (hence no threads)

ember ledge
ember ledge
cunning garden
ember ledge
cunning garden
ember ledge
cunning garden
ember ledge
#

what did you use?

cunning garden
#

squid, nginx (more like reverse proxy in this case), ssh

ember ledge
#

hmm, maybe that can work for me

cloud spruce
# inland sapphire architecture can be http/https but something over plain old TCP sockets is compl...

there is so many different solutions to choose from and it really depends on the project and your requirements, with so little knowledge of the project i can only touch very broadly on the subject

you could go with something as simple as sockets, but then you would need to add a message protocol on top of that to know when a message starts and ends
or you could go with http/https and using one of all the push technologies that can be used with it, or websockets or even gRPC if you really feel adventurous
or a light wight MQTT like so many IoT devices use, or a heavier message queue with subscription functionality like zeromq pub-sub, rabbitmq pub/sub, redis pub/sub or kafka

you would also need to think about if you require any encryption (https/ssl/tls) and/or authentication/authorization/accounting or access controls

threads aren't that good for io bound applications anyways, i would recommend going with some async library or framework instead

today http/https in some form is most likely the safest bet and is probably more future proof and versatile regardless of what direction your project takes going forward
using http/2 (or even http/3 that was finalized just over a month ago) you can multiplex several client requests and server responses as well as pushed data in parallel over the same connection
but don't use http/2 server push, despite it's name it isn't meant for what you would use it for, instead look at SSE (Server-Sent Events) or maybe websockets
if you decide to go with http/https i would recommend FastAPI (which can be used for more then just APIs) and is an async framework

which ever connection method and protocol you use you will need to think about keep-alive traffic and timeouts
that is, you will need to be sending traffic periodically from either one or both ends to prevent the connection from being removed from state tables in firewalls and NAT gateways and to detect a severed connection so that you don't get "false silence" on the connection

cloud spruce
cunning garden
cloud spruce
cloud spruce
ember ledge
# cloud spruce squid being very capable but also kind of a heavy wight if it's just for somethi...

could you send me some links?

I figured out what I need more clearly:
connecting to the proxy (username:pw:ip:port) then I want it to be handled like an api that you would build with flask as I want to do another request with the data modified instead of just routing it around and return that.
The most important thing is just that it can be used like a normal proxy you would get from a proxy service

cloud spruce
# ember ledge hmm, maybe that can work for me

after searching the internet a bit i realize that pre-compiled windows binaries was a limiting factor and that many projects don't carry them for their proxy servers
not even squid had even nearly up-to-date binaries for windows 😞
if it was me i would want free and open source software, and if it has to be for windows i would like the binary builds to be done by the project it self
so, what's left is:
mitmproxy a well maintained and in certain circles a very well known tool for reverse engineering and... lets just call it "other stuff", and it's written in python: https://mitmproxy.org/
privoxy which is a privacy focused proxy https://www.privoxy.org/ with binaries: https://www.privoxy.org/sf-download-mirror/Win32/3.0.33 (stable)/
i think the first one will be the best for you and cover most of your needs

ember ledge
cloud spruce
# ember ledge could you send me some links? I figured out what I need more clearly: connectin...

many web proxies are configured without authentication as standard
so all you need to be able to use them is the hostname or ip and the port they are running on
but if you really want authentication to be able to use the proxy you should use the established standard for that

i don't really understand what you wanted to do with the traffic
you will find it hard to read or do any modifications to the traffic as most web traffic today is encrypted using ssl/tls
when running such traffic through a proxy the client uses the connect method to tell the proxy where to connect and then it's just a dumb tcp forwarder to be able to proxy the encrypted traffic

ember ledge
# cloud spruce many web proxies are configured without authentication as standard so all you ne...

i wanted to use authentication as a way of implementing sessions like many proxy providers do.
the modification i want to do is to act as a a top-level proxy that depending on the session id requests on a different proxy server but since I dont think I got enough low-level control of the proxy servers i wanted to do the proxy requests as an api request basically reconstructing the headers/body to work with the proxy server api and then return the result

ember ledge
cloud spruce
# ember ledge the requests through the proxy will be made by another api where the proxytype i...

if it's just http and they don't redirected to you to https (as most sites do), you should be fine and be able to do what you want to do with the traffic
that is also more or less what the mitmproxy software is meant to do, it can even do it for encrypted traffic if you can install your own private root ca certificate on the client that you are trying to investigate the traffic for, unless the client software is really picky about the certificates by using certificate pinning or validates the certificates using the certificate transparency logs

ember ledge
cloud spruce
# ember ledge the requests the proxy should do are definitely https but the connection to the ...

no, the connection to the proxy is just clear text at the beginning when the client instructs the proxy where to connect to
then the client will switch to using encryption directly between the client and the server and the proxy is just forwarding the traffic blindly as it's encrypted
but if there is one piece of software that would help you with that it's mitmproxy or burp suite (not open source) https://portswigger.net/burp

#

but it's more involved when it comes to encrypted traffic
you will need to do a lot more work to bypass the encryption and it will take some cooperation on the part of the client to do so too
if the client is written with high security in mind you will not be able to bypass the encryption without modifying the client software to not make all those security checks, which is a completely different chapter in it self

ember ledge
cloud spruce
# ember ledge when the client is sending in clear text to the proxy where the proxy should con...

no, you would just have the same problem with the ssl/tls certificates unless you can make the client ignore certificate errors (which they shouldn't normally do, since that would open up for attacks)
make no mistake, this is kind of an attack on the traffic and if it was easy to bypass it wouldn't add the security that you expect and require from ssl/tls when you are using the web going about your daily business

#

i'm sure you wouldn't like it to be simple to break the encryption and have all your logins to all the places stolen and your bank account emptied and people using your credit card to buy expensive stuff online and placing you in debt for it

#

good and secure encryption is essential in today's society

ember ledge
cloud spruce
# ember ledge yeah definitely not but im just trying to find a solution to the limited proxy c...

bottom line is: if you want to be able to read and/or modify the traffic in such a way that the server would accept the traffic you will need to have some cooperation from the client unless the client is so badly written that it doesn't do any security checks at all and just accept any certificate without any warnings or anything (that would be really really bad)
using a proxy or not is not going to change that fact, you will have to fake the sites certificate and make the client accept the fake certificate in one way or another, against it's better judgement

ember ledge
cloud spruce
# ember ledge i have some sort of cooperation with the client so i could be getting it to acce...

then you will need to make mitmproxy generate fake certificates on-the-fly for the sites that the client requests to visit and then use that to decrypt the traffic and then re-encrypt it again with the real sites certificate
this is called a man-in-the-middle (the mitm in the beginning of the proxy name) attack which is used for reverse engineering and penetration testing all the time
ssl/tls is designed to defend against this attack and others under normal circumstances, that's why you should never ever accept/bypass such warnings if you see them when using the computer normally

ember ledge
cloud spruce
elder cobalt
#

Btw @cloud spruce just wanted to know, I recollect watching videos where people open proxies with the help of python on another system and then tamper with windows hosts file so that the game traffic or whatever traffic you are interested in will get sent to the PC which has its proxy open and through this people can do packet editing or anything they like

#

Problem is that if there's a way to proxy UDP packets as well?

#

Mostly I've seen people only proxy TCP

cloud spruce
# elder cobalt Btw <@936769916072259654> just wanted to know, I recollect watching videos where...

that's a very special case of proxying and is kind of a variant of transparent proxying, and as such it applies equally to all protocols above the ip layer (such as tcp, udp, icmp, sctp and so on)
the twist is that you would need to know the intended destination of the packets before hand and set the transparent proxy to forward all the traffic unconditionally to that destination
that's because the destination information is lost as the ip address is now rewritten to be the ip address of the transparent proxy host instead
unless the higher level protocol contains a copy of the destination so that one can use that, but that is rare as it is mostly wasteful for a protocol carry yet another copy of that same information

a better way would probably be to mess with the hosts routing table (for a destination that is not on the same network, for hosts on the same network you would need to mess with the arp table instead) to send all traffic for the destination host(s) or network(s) through the transparent proxy host and set up SNAT on the transparent proxy host
that way you don't loss the destination ip address information in the packets and you can inspect and even modify packets before forwarding them to the intended destination
and as you are doing SNAT you would get the return traffic and be able to do the same with that traffic as well

elder cobalt
#

I'm kinda lost there, because when it comes to domain names you can use the host file to change where to route the packets to but for IP addresses I don't find much information online

cloud spruce
cloud spruce
elder cobalt
#

so far when it came to proxying I could only think of saying python to open a socks5 port and then use a proxifier app to proxy an app to my socks5 port (it does not have options to use a proxy)

cloud spruce
# elder cobalt By chance is there any guide as to routing IP addresses to another IP?(Most pref...

on windows, to look at the current routing table: open cmd and run route print
to modify it: open cmd as an administrator and run something like route add 8.8.8.8 mask 255.255.255.255 192.168.1.50 and you can even add a -p option to the command to make it persistent between reboots, to remove a route again just run route delete 8.8.8.8

[only] for hosts on the same network (does not work for hosts not on a directly connected network) you will have to change the arp table instead:
run arp -a (you can add a -v as well if you want to see invalid entries too) to list all the current entries that are automatically populated using the arp protocol
to modify it you again need to be an administrator and run arp -s 192.168.1.30 01-23-45-67-89-ab where the first part is the ip that you want to modify the arp table for and the second is the hardware/nic/ethernet/mac address of the machine that you want to send the traffic to, to revert the change you can run arp -d 192.168.1.30

#

the computer you are sending the traffic to needs some special configuration as well to forward the traffic and to use SNAT, on linux that is pretty trivial to set up

elder cobalt
cloud spruce
cloud spruce
# elder cobalt Ah I see thanks for mentioning the route add statement, pretty much what I just ...

to make changes to the arp table persistent you would use netsh interface ipv4 add neighbors ... with the information where the ... is the interface, ip address and mac address

or if you want the currently recommended way of doing all of the above you would use powershell (also as an administrator) instead of cmd
and use Get-NetAdapter to get the adapter id for each network interface
together with Get-NetNeighbor, New-NetNeighbor and Remove-NetNeighbor to list and manipulate the arp table
or Get-NetRoute, New-NetRoute and Remove-NetRoute for listing and manipulating the routing table

elder cobalt
#

Ah I see thanks for all the points

civic sundial
#

maybe a stupid question but can i use the same port as minecraft for multiplayer (25565) for python sockets (for receving data)

cloud spruce
civic sundial
#

ok thx

cloud spruce
# civic sundial ok thx

what exactly is it that you want to achieve?
if it's to see the traffic you would set up a sniffer on your machine (or use raw sockets, that is more or less the same thing)

mystic haven
#
import socket
import datetime
from random import randint


def main():
    server_socket = socket.socket()
    server_socket.bind(("0.0.0.0", 8820))
    server_socket.listen()
    print("Server is up and running")

    (client_socket, client_address) = server_socket.accept()
    print("Client connected")
    while 1:
        data = client_socket.recv(1024).decode()

        if data == "TIME":
            client_socket.send(str(datetime.time()).encode())
        elif data == "WHORU":
            client_socket.send("BRUH".encode())
        elif data == "RAND":
            client_socket.send(str(randint(1, 10)).encode())
        elif data == "EXIT":
            client_socket.close()
            server_socket.close()


if __name__ == "__main__":
    main()
import socket
import datetime




def main():
  while True:
    inp = input("Command to type: ")
    my_socket = socket.socket()
    my_socket.connect(("127.0.0.1", 8820))
    my_socket.send(inp.encode())
    data = my_socket.recv(1024).decode()
    print("The server sent " + data)
    my_socket.close()


if __name__=="__main__":
    main()
``` any idea why is my server crashing after the first command I give it
inland sapphire
#

I too also use bruh as a standin debug message

mystic haven
#

and bruh is a great standin debug message

inland sapphire
#

just the two variables separated with a comma unpack the variable

inland sapphire
#

No in thr accept part

#

In your server code

mystic haven
#

connect part

inland sapphire
#

Connect takes a tuple

mystic haven
inland sapphire
#

Accept returns two vars

#

No keep connect as a tuple

mystic haven
#

so where

inland sapphire
#

Your client code is fine

mystic haven
#

ok

#

ohh

#

in accept

inland sapphire
#

Yea

#

Server_socket.accept()

#

Unpack the variables

mystic haven
#

its still not packing lol

inland sapphire
#

Whats your server code?

mystic haven
#

why not packing im a du dum

#

i meant owrking

#
import socket
import datetime
from random import randint


def main():
    server_socket = socket.socket()
    server_socket.bind(("0.0.0.0", 8820))
    server_socket.listen()
    print("Server is up and running")

    client_socket, client_address = server_socket.accept()
    print("Client connected")
    while 1:
        data = client_socket.recv(1024).decode()

        if data == "TIME":
            client_socket.send(str(datetime.time()).encode())
        elif data == "WHORU":
            client_socket.send("BRUH".encode())
        elif data == "RAND":
            client_socket.send(str(randint(1, 10)).encode())
        elif data == "EXIT":
            client_socket.close()
            server_socket.close()


if __name__ == "__main__":
    main()
inland sapphire
#

server output?

#

Is there an error or anything?

mystic haven
#

nope

#

just freezing

inland sapphire
#

Oh i think i know

#

You have to put .accept in your while loop

#

Otherwise your server never accepts connections ahain

#

since your client closes

#

which is bad design actually

mystic haven
#

it is workingggg

#

yes

#

but why

#

why cant I use the same socket

inland sapphire
#

because your client is closing it

#

Socket.close() destroys the connection

#

You may want to read up on the socket api

mystic haven
#

thanks @inland sapphire

#

also I changed it so now it doesnt break it every time

#

but now its doing the same thing

inland sapphire
#

Wdym same thing?

#

Once you remove the close() call in client you have to move accept() out of the while loop

mystic haven
#

ik

#

thats why I dont understand why is it doing that

#

freezes again

inland sapphire
#

Show code?

#
  • terminal output
mystic haven
#
import socket
import datetime
from random import randint


def main():
    server_socket = socket.socket()
    server_socket.bind(("0.0.0.0", 8820))
    server_socket.listen()
    print("Server is up and running")
    client_socket, client_address = server_socket.accept()

    print("Client connected")
    while 1:
        client_socket, client_address = server_socket.accept()
        data = client_socket.recv(1024).decode()

        if data == "TIME":
            client_socket.send(str(datetime.time()).encode())
        elif data == "WHORU":
            client_socket.send("BRUH".encode())
        elif data == "RAND":
            client_socket.send(str(randint(1, 10)).encode())
        elif data == "EXIT":

            client_socket.send("Closing up".encode())
            client_socket.close()
            server_socket.close()
            exit()


if __name__ == "__main__":
    main()
#
import socket
import datetime




def main():
  while True:
    inp = input("Command to type: ")
    my_socket = socket.socket()
    my_socket.connect(("127.0.0.1", 8820))
    my_socket.send(inp.encode())
    data = my_socket.recv(1024).decode()
    print("The server sent " + data)
    my_socket.close()


if __name__=="__main__":
    main()
inland sapphire
#

You cant accept twice of your not connecting twice

#

And you still have a close() in your while loop

#

This server client code is a mess lol

#

i highly advise you read up on how sockets work

mystic haven
#

i read from a book

inland sapphire
#

Itll only take 10 minutes tops and you wont be making these mistakes

mystic haven
#

the book is trash

inland sapphire
#

Lol

mystic haven
#

they had a server code

#

that didnt work

inland sapphire
#

read the python docs they have a short segment on socket fundamentals

#

at this point your blindly pasting code in based on my suggestions

mystic haven
#

ok

inland sapphire
#

Yeh just read through that real quick

tidal wind
#

hi

bright orchid
#

Guys i just wan to print out this py data = subprocess.check_output(['netsh', 'wlan', 'show', 'profiles']).decode('utf-8').split('\n')

#

but i get this error

#

UnicodeDecodeError: 'utf-8' codec can't decode byte 0x81 in position 76: invalid start byte

#

I can't find a solution

cloud spruce
cedar forum
#

i'm on windows

#

let me test

#

but yeah, this is a pygen thing

cedar forum
#

🀦 i installed WSL to install python 3.11 only to remember that the whole problem here was testing a windows command

#

lol

ember ledge
#

what is Paramiko

hollow cipher
#

Im playing around with a Pi Pico W and trying the use the network lib. I manage to starta a webserver once but whenever i restart my Pico i get this error:
Traceback (most recent call last):
File "<stdin>", line 44, in <module>
OSError: [Errno 98] EADDRINUSE

This is happening when i try to bind the same address again to my socket.
addr = socket.getaddrinfo('0.0.0.0', 80)[0][-1]
s = socket.socket()
s.bind(addr)
s.listen(1)

I'm following this post: https://www.raspberrypi.com/news/how-to-run-a-webserver-on-raspberry-pi-pico-w/

You can now run a webserver on your Raspberry Pi Pico W to allow you to control things remotely. Game changer.

hollow cipher
#

I can add that i'm doing this in micropython.

urban shuttle
#

i need get get a rasberry pi!!!!! 😠

cedar forum
hollow cipher
cedar forum
fossil tinsel
#

hello guys, was wondering if anyone had any experience making telnet scripts?

cedar forum
elder cobalt
#

@cloud spruce Hello again πŸ˜… , was doing a-lot of testing and I found out an interesting issue, for some reason using reverse follow and going on maps which have alot of elevational changes the car keeps flying, I suspect target.position.y is supposed to be in play here but I can't seem to figure out why it's sinking even when the packets I'm sending is reaching to my other client at the same time?

#

could it be because of ping?

#

where we have to compensate over here? because on maps which are flat it's working as intended

#

okay it looks like if I comment out + relative_position_x and + relative_position_z although my observer is clipping into targeted car it seems to not fly off this time

#

I'm thinking maybe there's something more we need to modify with observer.position.y = target.position.y

#

tbf I don't really know if we manipulate the Y axis alone it would fix the issue, maybe something slightly off within relative position X and Z?

elder cobalt
cloud spruce
cloud spruce
# elder cobalt this should explain it I guess?

i think it will be hard to compensate for as we are not following the ground then it changes elevation, we don't even know anything about the map
as we are "following" in front of the target without knowing anything about the world, we will just pitch and roll with the target

elder cobalt
#

when my target car is behind me, the car keeps sinking
when my target car is in front, the car keeps flying

cloud spruce
#

we are more or less just an extension of the target in front of it, but yeah, we probably should be manipulating the other axis as well
it will never be perfect but it could at least be better

#

right now we are just adjusing the x and z axis and not the y asis, we probably should, but it will still be strange when a up or down slope ends

elder cobalt
#

hmm yeah

cloud spruce
#

and your "observer" client don't even know what we are doing to it's packets

elder cobalt
#

Btw any idea as to why when I comment out the relative position the car doesn't seem to fly or sink?

#

Oh yeah it looks like this was an issue before as well for some reason not touching the Y axis but modifying the X and Z axis it seems to fly

cloud spruce
#

if we can change the y position in a similar manner by looking at the rotation of all the three axis and adjusting our position accordingly along all those three axis it should probably look a little bit better

elder cobalt
#

yeah, it's either we remove the relative position for X and Z (which isn't what we want)
or modify the Y axis such that it has a correlation with X and Z axis?

#

but should it be a correlation between X and Z axis or X axis + X_relative_position and Z axis + Z_relative_position?

cloud spruce
#

yeah, i think the last option will be the the best, but just remember that anything can be in front of the target, such as a wall, the ground or open air (so that the observer will be looking like it's flying)

cloud spruce
#

i think we need to find out which of the y and the z rotation axis is the pitch and which one is the roll axis

elder cobalt
cloud spruce
#

for example by looking at how the rotation axis for those two change when you go up hill or down hill on an otherwise quite flat road

#

oh, is that so?

elder cobalt
#

yep

elder cobalt
#

luckily I have one of those test grids with elevation changes should help out

cloud spruce
#

at least we can learn if up hill is a positive or a negative change on the axis, depending on which was the axis is pointing in relation to the car, logically it would be positive up hill, but with this game you never know πŸ˜‰

elder cobalt
#

alright so I've taken these around -180/180 in-game compass or -0.0/0.0 (rads)

#

so on flat land

#

uphill

#

elevated area

elder cobalt
#

downhill

#

okay so with Y velocity, if I go uphill my value becomes positive, on downhill it becomes negative (if my car faces the opposite side or if I go in reverse gear)

#

but I doubt that could help since mountain elevation changes on Y velocity are not really that noticeable

cloud spruce
#

there is no way to see rotation in-game, just position?

#

in that case it would be good to have data from from the network packets using the script with the --no-teleport and verbosity set to 1 so that we can see the data from there

elder cobalt
#

O hold on

cloud spruce
#

so that we know how the data looks when it's flat and when it's going up hill or down hill

cloud spruce
elder cobalt
#

on a flat land

#

slight descent

#

ehh this feels alot irregular hold on

cloud spruce
#

a bit of a steeper angle in just the pitch direction and as little roll as possible would probably help a lot

elder cobalt
#

flat land

#

huge uphill

#

on elevated area

#

huge descent

cloud spruce
elder cobalt
#

wait a slight issue

#

you can clearly see

#

how there's no downward path

cloud spruce
#

just for fun, could you put the car with either the left or the right car towards the down hill just to check which way is which on the z rotation axis as well?

elder cobalt
elder cobalt
elder cobalt
cloud spruce
#

reverse engineering through raw netowrk packet data 😁

elder cobalt
#

didn't quite get that

cloud spruce
#

try to turn/rotate the car 90 degrees to the right or left

elder cobalt
cloud spruce
#

yeah

elder cobalt
#

gonna be sorta tricky but will try

cloud spruce
#

can imagine

elder cobalt
cloud spruce
#

perfect πŸ‘

elder cobalt
#

anything else? gonna hit the bed soon

cloud spruce
# elder cobalt anything else? gonna hit the bed soon

since you have already experimented quite extensively with the compass heading you might know off the top of your head
if going north in the game will take to towards the positive or the negative on the x or the z axis, as well as the same if you go east

#

i'm already quite sure a higher elevation will take you towards the positive on the y axis

elder cobalt
#

yeah it looks like if your going up Y axis becomes positive

#

I recollect playing with the Y axis rotation, setting it to 90 degree made my car stand up

cloud spruce
#

how about north and east respectively?

#

yeah, but not rotation, just position now

elder cobalt
#

hmm haven't tried that out yet

cloud spruce
#

so that i understand the layout of the coordinate system as well as the rotation

obtuse spruce
#

sa

cloud spruce
#

okay, maybe another day then

elder cobalt
#

aight

#

what else do you need?

elder cobalt
cloud spruce
#

i just wanted to know if driving towards the north takes to towards the positive or the negative on the x or the z axis when we are talking position, not rotation

#

and the same question for going east instead of north

#

nothing with rotation, just position now when you go towards one cardinal direction and then when you go to wards another

#

i think we got all the rotations down now, now it's just position in the x and z

elder cobalt
#

well facing north this is start

cloud spruce
#

and if you drive a bit towards that direction?

elder cobalt
#

wtf -135?

#

o ye

#

makes sense

cloud spruce
#

if you go a little bit further and as straight as you can so that the other numbers don't move so much

elder cobalt
#

North start

#

north stop

cloud spruce
#

okay, so north is negative on the z βœ…

#

and how about east as straight as you can?

elder cobalt
#

east start east stop

#

oops

#

first image start the second is stop

cloud spruce
#

okay, so east is positive on the x βœ… πŸ‘

elder cobalt
#

east start

#

east stop

#

just verifying it

latent sandal
#

is this the best place to go for python sockets stuff??

cloud spruce
# elder cobalt just verifying it

just had to check from which country the game studio originates from since things are a bit weird looking at the packet data, google says italy
i almost though it was from "down under" since things where a bit upside down πŸ€ͺ

cloud spruce
latent sandal
#

alright cheers i'll try my best to summarise

#

basically i'm making a Golden Balls Tv Show clone but im focusing on the networking stuff

#
def receieve_message():
while True:
    
    command = client.recv(2048).decode(FORMAT)
        
    if command == "VOTE":
        round_one_vote = input("Who would you like to remove: ")
        message = ("VOTE1 "+round_one_vote)
        send(message)
        
    else:
        print(command)```
#

using this to receive data and i'm using this on the server side to send the word VOTE

#
for client in clients:
        client.send("VOTE".encode(FORMAT))```
#

problem is that sometimes the client prints out "Who would you like to remove:", which is correct, but sometimes it prints out "VOTE" and the client that prints incorrectly seems to be random and it changes each time i run the program

#

basically just the conditional is breaking sometimes even though every time i run the game the same thing is being sent and each client receives data the same way

#

clients is a list containing each conn

elder cobalt
#

@cloud spruce found it, it's ODE

#

open dynamics engine

cloud spruce
#

yeah, seem to be the physics engine, but might not be related to the strange coordinate system and data format found in the packets with the 180 degree flip for north and south and so on

#

cool that it's open source and very freely/permissively licensed

#

seem like they started out with unity and then moved to write there own game and graphics engine (the graphics part using DirectX 11) and ODE for physics
i really wonder about the networks parts of the game engine, if that is fully home grown as well as the rest of the core game engine or if they based it on something else like they did for the physics part

cloud spruce
# latent sandal basically i'm making a Golden Balls Tv Show clone but im focusing on the network...

sorry, don't know the show, but i googled quickly
my understanding is that it's about casting votes on who should be eliminated
so i kind of understand the connection with your software and the general logic
anyways, that isn't required knowledge
but i think you're not showing enough of your code to be able to come to a conclusion of why it's going wrong
and if the top piece of code is for the client i don't see how the input() could print out anything else then what's enclosed in that command to the user

latent sandal
#

the stuff in the first conditional isn't really what i'm looking to fix, the problem comes from the conditional sometimes not catching that the command is VOTE, yet still printing out the word VOTE

#

on the occasion that all 4 clients decide to work, the input works correctly (as long as i put valid numbers and stuff like that)

elder cobalt
cloud spruce
latent sandal
#

my server has threads for individual clients but only for receiving data, sending data is done in the general game code but only when I want to send things in batches

#

and then each client runs their own version of the code

cloud spruce
cloud spruce
latent sandal
#

i'd give it a look, but the stuff in the threads isn't really interacting with the error

#

does the conditional on the client look correct?

cloud spruce
# latent sandal does the conditional on the client look correct?

this is more theoretical in your case as you are sending such small amounts of data
but you shouldn't trust that client.recv(2048).decode(FORMAT) will return a full line
it could be just one byte or up to 2048 bytes or even no bytes at all for an error condition

fossil tinsel
cedar forum
fossil tinsel
#

and using time sleep in between commands, but for the download, since the time can vary I want to use something else to test whether the docker download is done so it can move onto the next command

#

if that makes sense

cedar forum
#

right okay, well in that case on the server side you need to receive the command, start the download and send a further message once that process is done

#

you need to read from the remote as well as issuing commands

fossil tinsel
#

right, the issue is there is no uniform string that is outputted after the docker download is done, it spits out a container id which changes every time

#

and I cant test for that because it changes

cedar forum
#

does it have to be uniform?

#

can't you just send a message once the subcommand has terminated?

fossil tinsel
#

thats what I am trying to figure out

#

sorry I am new to this

#

how do I know the command has terminated?

cedar forum
#

do you have any code samples

fossil tinsel
#

yeah

#

one sec

cedar forum
#

so you're receiving a command, spawning off something like docker run right?

fossil tinsel
#

substring 3 tests for the name of the container within docker ps -a, XXXX is the name

#

the two minute sleep is completely unnecessary and long but I needed a long enough buffer that ensures completion

#

and I wish I could use paramiko instead but ssh doesnt play nice

#

with these devices

cedar forum
#

hmmm right

#

do you have a sample output of the docker run command

#

i think the better way to do this without SSH would be to have a python script running on the receiving end using subprocess and reporting back over the telnet connection when the command has finished and what the exit code is

fossil tinsel
#

the issue is, its a router so I cant really run a script on that end of it

#

the os doesnt allow it

cedar forum
#

riiight okay

#

hmmmm

#

yeah other than searching for a container ID in output i guess you're limited on what you can do there

fossil tinsel
#

yeah the output changes for everytime its run

cedar forum
#

if docker can run then there should be some flexibility in stuff on the end machine

#

the container ID changes, but not the format of it right?

fossil tinsel
#

actually I think the format stays the same

cedar forum
#

I haven't used Docker in a while so trying to remember what a docker run output would look like

#

because container IDs will be random but consistent length and format and whatnot

slow zinc
#
import socket
import sys 
from datetime import datetime
portas = [21,80,443,8080,22, 25565]
target = input(str('Target IP: ')) 

print ('-'*30)
print(f"Scanning Target: {target}") 
print ("Scanning started at: " + str(datetime.now()))
print ('-'*30) 

try: 

   for port in portas:
      s = socket.socket(socket.AF_INET,socket.SOCK_STREAM) 
      socket.setdefaulttimeout(0.5)

      result = s.connect_ex((target,port))
      print(result)
      if result == 0:
         print (f'[*] Port {port} estΓ‘ [Aberta]') 
         s.close()
      else: 
         print (f'Porta: {port} Fechada')
except KeyboardInterrupt:
   print ('\n Exit') 
   sys.exit()

except socket.error: 
   print ('\n Host not responding:')
   sys.exit()
cedar forum
#

you should also be able to get docker to output JSON

#

which might make it easier for you

slow zinc
#

Who knows how to solve it, mention me

fossil tinsel
#

one sec let me find the output format @cedar forum

cedar forum
#

πŸ‘

fossil tinsel
#

found this online, this is what it would look like

#

I dont have access to the devices right now

cedar forum
elder cobalt
#

a @cloud spruce I tried normalising the rotation of Y axis position, rotation and velocity but it still looks alot more wonky with how it's only doing +1 or -1

elder cobalt
#

I feel like the sinking and floating issue is sorta hard to deal, because maybe at the Y elevation your standing might not be the same for the other car which might be 5 meters in front/back of us so the car might sink or float instead of touching the road

cloud spruce
elder cobalt
#

And not too far away

cloud spruce
hushed birch
#

Is there a way to find MX servers without installing a third-party module? Or have smtplib send through MX servers?

quartz frigate
hushed birch
#

The mail servers recommended by my organization's are "the MX servers for our domain"

#

I can use smtplib send through that if I give the hostname, which is mxb-something.pphosted.com, but I'd prefer to have my script lookup the current MX and send through that, rather than hardcoding the current hostname which is sure to change

#

I don't want a SMTP server, I just want to send 1 email from a script

quartz frigate
hushed birch
#

probably often, it is a third-party service

#

given their autogenerated look I wouldn't be surprised if they changed at least once a year

quartz frigate
#

It shouldn't be changing
That would break your ability to receive emails

#

Regardless, Python doesn't have a builtin package for DNS, yeah, you would have to get a third party package to check for updated records

hushed birch
#

We are really getting away from my question but no, of course you can change MX records with no unavailability

#

you just turn off the old ones after the change

#

That's a shame, DNS is such a tiny and useful protocol

quartz frigate
hushed birch
#

Now I'm curious though, since smtpd is in the standard library for now, how does it do MX lookups?

#

oh it doesn't actually send emails

cedar forum
#

in the same way when you go to google.com it looks up the A record to get the IP address, when you send an email it'll look up the MX (mail exchange) server for the domain

#

they shouldn't change often, it's set by your companies domain administrator, you might have multiple of them

quartz frigate
ocean bay
#

In the OSI model, how do switches know the MAC address of the other system?

cedar forum
#

smtplib you're responsible for finding the MX and connecting to that

quartz frigate
#

I see

cedar forum
#

python doesn't ship with a DNS client, it uses the hosts configuration and syscalls to resolve addresses

cedar forum
#

the switch has memory as well, so if a port goes down and comes up again, the switch might take an educated guess within a reasonable timeframe that the same MAC is still there

#

now that does leave the scenario where a switch might not have received a frame from a host yet but receives one destined for it, then the MAC address won't be in the table, so in those situations (which are decently rare), the switch will fallback and forward the packet to all ports connected

#

every port except the one it was received on, of course

#

hope that explains it a bit

ocean bay
#

Thanks! This is my first any bit of networking so just trying to decipher for a bit haha

cedar forum
#

networking is pretty awesome, good approach familiarising yourself with the different layers of OSI model and the hardware involved πŸ™‚

#

switch management is pretty fun stuff -- our main switch here, lots of stuff going on

hushed birch
cedar forum
#

it does, so you need to use something like dnspython to find MX

hushed birch
#

That it's the same under the hood does nothing for me unfortunately

#

dnspython is a third-party module

cedar forum
#

right, if you're looking to keep things solely standard library then you can't find MX records

#

you could write your own DNS client with sockets but.......

#

i think that'd be quite a lot of pain for little reward

hushed birch
#

Yeah I considered it honestly πŸ˜‚

cloud spruce
#

yeah, either include a third-party library like dnspython, it's good, ive used it a lot
or implement your own, which might sound like a small task for the simplest bits, but it's larger then you probably imagine, lots of rfc:s if you really want it to work
for example, when the response is to large to be able to deliver in one dns udp frame you will have to switch to tcp regardless of if you want to or not

#

even if the third-party library isn't available in your environment you can include it in your project instead

hushed birch
#

dnspython depends on Cython

cloud spruce
#

ah, right, if you are in a very constrained environment you might look for a pure python implementation instead

#

it looks like here is a few async/aio implementations out there for dns that are pure python

ocean bay
hushed birch
#

A physical port on the switch, that you can plug a cable into

ocean bay
#

Oh haha

#

What's an ethernet frame?

#

I saw that it's something on the data link layer that can hold things including the source and dest MAC addresses yea?

hushed birch
#

an ethernet packet

wooden stream
#

whats a websocket?

ocean bay
#
 when a port first goes up and sends a frame the switch will note the source MAC address and add it to the mac address table

So when you physically connect a port to that switch, the port sends out an ethernet frame that reads the source MAC address I assume

hushed birch
wooden stream
#

can http not do that?

cedar forum
#

every time you send a packet on a switch it's contained within an ethernet frame

hushed birch
cedar forum
cedar forum
wooden stream
ocean bay
#

hmmmm alright

cedar forum
#

awful transparency, sorry for that, but that sums up how the different packets are encapsulated

#

at the ethernet level it's called a "frame" because there is an actual footer in there, it's not just header then data, it's header, then data, then footer

#

hence it has been "framed"

ocean bay
# cedar forum

Ohh the actual name of the data changes as you add headers to it gotcha

cedar forum
#

yeah, each layer of the OSI model has a different word to refer to what goes over it

#

actual packet routing on the internet looks something like this

ocean bay
#

Im still a bit confused on how the switch gets the, specifically, destination MAC address

cedar forum
#

each router will unpack the packet to layer 3 to find the IP address (layer 3 is network, IP packets), then use that to find the next hop MAC and repack it

hushed birch
ocean bay
#

I can see how, in the transmit data phase, the switch can read the MAC address of the host frame, but how can the frame also have a destination MAC address?

hushed birch
#

just like an IP packet has the source and destination IP addresses put in there by the sender, the Ethernet frame has the source and destination MAC addresses

ocean bay
cedar forum
ocean bay
#

I looked it up and the MAC address is like a unique identifier on the NIC of a host computer

#

so a bit confused on how a frame can get the destination's MAC

hushed birch
cedar forum
#

a frame can't "get" the destination MAC, a computer determines the MAC address it needs to send to and packs that into an ethernet frame

#

and yeah, that uses ARP

#

so if you want to send a packet to the IP 10.144.95.1, your PC will first send out an ARP broadcast saying "who has 10.144.95.1, please tell <your PC>"

#

then the computer that has that IP will reply saying "yeah, that's my IP, here's my MAC"

#

then the sending computer will put that MAC into an ethernet frame and send it

#

that's a big simplification of it, because not all destinations will be on the network, so things get more complex when you've got to go through multiple switches and routers, but as a very simple model that's how ethernet frames and ARP work

ocean bay
#

Thanks!

cedar forum
#

on Windows, you can see what's in your ARP table using arp -a

ocean bay
cedar forum
#

if you're sending from A->B, you'll set the source MAC to your own MAC of A, then the dest MAC to the MAC of B, when B gets that and wants to reply it'll flip it around and send a return

ocean bay
#

Oh cool so A sends its ethernet frame with a source MAC to B, then B writes its MAC on the frame and sends it back to A

cedar forum
#

pretty much, it's like the return address on a letter you get in the mail

ocean bay
#

sick sick

cedar forum
cloud spruce
#

ethernet is actually optimized in a way ip isn't, the destination mac address comes first in the ethernet header, while in ip the source comes first

#

i guess the people that designed ip didn't think of optimizing it as much as the people that designed ethernet and just used what seems most logical for us humans

#

i think that was kind of a mistake, but whatever

cedar forum
#

huh that's interesting

#

i didn't ever notice that

#

smart smart ethernet folks

cloud spruce
#

yeah, so the device can take a decision earlier in the data stream

#

the source is not as interesting when forwarding or receiving traffic

hushed birch
#

I don't know if anyone would want to take a routing decision from the IP header before receiving the entire ethernet frame

#

that seems kind of intense, whereas I can totally see switch hardware doing that with the ethernet header

cloud spruce
#

still, you wouldn't need to read as far in to the packet and skip quite uninteresting data

hushed birch
#

skipping takes no effort at all

cloud spruce
#

you would still have to wait for those bits to come in

#

and there is such a thing as low latency networking when every nanosecond count

#

but otherwise it's quite academic

hushed birch
#

I don't think if the protocol allows for forwarding IP packets before receiving it in full

#

If you're switching, you can send the exact same frame, but if you're routing you are necessarily changing it

#

the MAC addresses will be different at least

cloud spruce
#

there are hardware that optimize things outside the specs but the end result will still be as if they followed the specs to the letter

hushed birch
#

The ethernet checksum is at the end so it might be possible

#

interesting

cloud spruce
#

but i guess that is kind of exotic hardware with a price tag that is eye watering for everyone that doesn't require it

hushed birch
#

It would also limit the features, when routing in that mode you can't make decisions based on TCP port, packet size, etc

ember ledge
cloud spruce
hushed birch
#

I wouldn't think they use IP for that but I wonder

#

(or ethernet)

cloud spruce
#

not routing but the do use switching on the ip layer to talk to the stock market systems

hushed birch
#

that is surprising, given that things like Infiniband are commercially available

cloud spruce
#

at one point they where not allowed to have servers there, only network equipment, so they started using switches with FPGAs and upload code directly to them πŸ˜†

#

also for having the code run fast by the FPGA and skip the round-trip time back to the company network

hushed birch
#

Well if they are abusing networks not meant for high-frequency that's something else. I would be surprised if they used ethernet & IP in networks designed for low-latency

cloud spruce
#

nowadays the stock markets in most well regulated markets has a requirement to give everyone the same length of cables within the same data center just so that it's fair

hushed birch
#

the free market regulating itself is such a farce. If we need referees deciding what is fair and what's not for it to work, it's already failed

cloud spruce
#

they still use eithernet and ip for communication between external parties and the stock market because the stock market wants a unified and well tested boundary towards external parties

#

yeah, this was decided for outside of the market itself, as long as they could they would sell the closest locations (with the shortest cables) to whom ever would pay the most

#

you can trust that if there is room for greed there will be someone that takes that opportunity to make a buck

cedar forum
#

400Gb/s on a single FPGA

cloud spruce
cedar forum
#

hmm

#

yep

#

!warn @ember ledge don't spam all-caps messages linking to a stackoverflow question. if you are looking for answers, try describe the problem in discord in a reasonable manner.

errant bayBOT
#

:incoming_envelope: :ok_hand: applied warning to @ember ledge.

cloud spruce
#

or if this is the predecessor of P4 maybe πŸ€”

ember ledge
ember ledge
cedar forum
#

i've used P4 briefly before

#

nice stuff

cedar forum
ember ledge
wicked salmon
#

Hello folks, I have always been interesting in working on a network project using python but I have no idea on what kind network project to build on my own, any suggestions? I have always been interested in building a low latency project but am not sure if python is the proper language for a low latency project

elder cobalt
#

uhh @cloud spruce I've just noticed in my server logs for some reason when ever I edit packets it starts to spam the logs which it did not before, I found a single code responsible for it so far.

                if target is None:  # or use cached conversion
                    # convert partial packet payload to struct and cache it
                    target = UpdateIn.from_buffer(bytearray(target_data))
#

these are the server logs

#

tick tack is a name I've given to another client

#

I don't understand what the logs really mean here

elder cobalt
#

o fixed it

#
                if client_modify:
                    observer: UpdateOut = UpdateOut.from_buffer(bytearray(packet.payload))
                    observer.position.x = target.position.x + relative_position_x
                    observer.position.y = target.position.y 
                    observer.position.z = target.position.z + relative_position_z
                    # rotate 180 degrees, or math.pi in radians
                    observer.rotation.x = target.rotation.x + math.pi
                    observer.rotation.y = target.rotation.y
                    observer.rotation.z = target.rotation.z
                    observer.velocity.x = target.velocity.x + relative_position_x
                    observer.velocity.y = target.velocity.y
                    observer.velocity.z = target.velocity.z + relative_position_z
                    observer.tyre_fl = target.tyre_fl
                    observer.tyre_fr = target.tyre_fl
                    observer.tyre_rl = target.tyre_fl
                    observer.tyre_rr = target.tyre_fl
                    observer.steer_angle = target.steer_angle
                    observer.wheel_angle = target.wheel_angle
                    observer.engine_rpm = target.engine_rpm
                    observer.gear = target.gear
                    observer.status_flag = target.status_flag
                    observer.gas = target.gas
                    # convert struct to bytes and update the packet payload
                    packet.payload = bytes(observer)
                    #divert.send(packet) # Problematic one!
#

apparently I had divert.send(packet) at the end which was not needed

cloud spruce
# wicked salmon Hello folks, I have always been interesting in working on a network project usin...

it all depends on how low of a latency you require
but sure, there might be other languages better suited for very low latency then python
and if you're really looking for low latency your average pc with a normal OS may not even be enough
then you might be looking at a (hard or soft) real time OS of some sort or even specialized hardware such as SmartNICs, NPUs or FPGAs for ultra low latency
on the other hand, do a PoC in python first, try to optimize it a bit and see how far you can get with such a solution, it might just be enough for your use case πŸ™‚

#

yeah, this would be the perfect place for that, just ask your question here and we'll see if anyone can answer you

cloud spruce
rose oxide
#

Hello, I am using fastapi and I have a post endpoint for user signup and login. I've used pydantic base class for typing the arguments. class has username and password fields only. May I know how do I test this endpoint through postman API? Like where do I add these parameters in postman API?

cloud spruce
ocean bay
#

In the OSI model, im a bit confused on which layer exactly data gets sent to the other machine. From what I've read

  1. Data gets sent in the session layer, e.g. unsure how but apparently you can download files in the session layer.
  2. Segments also gets sent in the Transport layer, e.g. data transmission with TCP and UDP,
  3. Packets get sent through routing, where the IP address and mask determines to which network, and subsequent machine the packet gets sent.

However, according to the model, it's more so that data gets encapsulated down the layers until it reaches the physical layer, where the physical layer sends the data to the other machine and the other machine decapsulates the data the other way around.

Just confused on the mental model of data being sent in the OSI model if someone could help clarify, thanks!

cloud spruce
ocean bay
#

But now im confused as to the point of the different concepts in the different layers. e.g Whats the point the session layer then since it doesnt encapsulate the data?

Was the stuff I dot pointed down, 1 2 3 and 4 not right? Im especially confused about the fact that data is transmitted via TCP at Layer 4.

I suppose if you say everything doesnt fit in the model ill begrudgingly accept that haha

cloud spruce
# ocean bay But now im confused as to the point of the different concepts in the different l...

it's a very general and theoretical model, nothing is really transmitted by any other layer then layer 1, the other layers just prepares and formats data before transmission and unpacks and parses parts of the packet on reception of data, many things will mostly just deal with layer 2 (ethernet), 3 (ip),4 (tcp, udp, etc) and 7 (http/https, ssh and so on)
layer 5 and 6 on the other hand isn't as well defined or as separate in most protocols and applications they mostly blend in with layer 7

pearl lion
#

Id like to get a list of all the IP's my PC is connected to. I was trying with psutil.net_connections() and can pull back a list of lists

z = psutil.net_connections()
for i in z:
    for j in i:
        print([j])

Which returns the a list information. Below is an example of one of the iterations through j.

[-1]
[<AddressFamily.AF_INET: 2>]
[<SocketKind.SOCK_STREAM: 1>]
[addr(ip='192.168.0.69', port=51721)]
[addr(ip='52.211.92.220', port=443)]
['ESTABLISHED']
[13008]

is psutil the way to capture my 'remote' ip which happens to be j[4] in the output or is there a better library to use?

#

I discounted using system and netstat

untold dawn
cedar forum
#

you're thinking of the DoD model

cloud spruce
#

or maybe what has been called the TCP/IP model that has five layers vs the four layers of the DoD model or seven layers of OSI

steady horizon
#

You can see your public IP with

from urllib.request import urlopen
from json import load
with urlopen("https://www.ipinfo.io/json") as response:
    data = load(response)
    print(data["ip"])
#

IPinfo’s geolocation API can be used without needing to create an account and without any authentication. That makes it easy to try out and works well for occasional queries. For more serious usage, we strongly recommend creating an account which will provide you with an API token and offers several benefits over making unauthenticated requests.

wicked salmon
cloud spruce
ember ledge
#

Can you host a websocket server on an ip of your isp? or does some isp not allow it?

cunning garden
ember ledge
cunning garden
untold dawn
untold dawn
cloud spruce
# ember ledge Can you host a websocket server on an ip of your isp? or does some isp not allow...

i agree with @cunning garden and just want to add that some ISPs will have some filtering, quite commonly on port 25 both inbound and outbound which blocks you from running your own smtp mail server as well as directly communicating smtp servers on port 25 on the internet other then theirs
or you might be behind CGNAT, especially on mobile networks, which will be a hindrance for you to be able to self host anything on that connection without a reverse tunnel to a gateway of some sort (for example hosting a TOR hidden service would still work as long as you can get out on TOR)
but as long as your ip address is reachable from the wider internet you'll probably be fine (depending on laws of the country and region your in as well as possible TOS)

cloud spruce
pearl lion
ocean bay
#

How do you determine a gateway IP?
Like does the gateway IP address follow a certain pattern w the IP addresses of the network devices? e.g. If I have 2 devices on a network with IPS, 10.10.10.10 and 10.10.10.11, with a mask of 255.255.255.0. What would the gateway IP be?

cloud spruce
ember ledge
steady horizon
pearl lion
#

People stop talking about gateway addresses. It's not what I want I want a module I can use to pull remote/public IP addresses from my pc a la netstat.

steady horizon
pearl lion
#

I'm an amature programmer but an infrastructure and cybersecurity professional. There is no accesiable ip I am related to in the post. If you did a ipwhois you would find its owned but someone else

ocean bay
#

Within a network, does the switch determine which machine to send messages to based on the MAC Address or the IP address of the machine.

Im confused since the part of the IP address that isn’t part of the mask is unique among devices in a network, and so it would make sense for the switch to identify machines based on the IP address, yet I also read that switches use the MAC Address to identify machines

cedar forum
ocean bay
#

Ahh that makes much more sense

#

So then if switches mostly use MACs to find the machine, whats the point of making IPs unique within a network, e.g 190.190.190.1, 190.190.190.2 instead of making the IPs all uniform

#

And conversely, if youre using a layer 3 switch whats the use of framing the packet w MACs

cedar forum
# ocean bay So then if switches mostly use MACs to find the machine, whats the point of maki...

MAC addresses can only identify a single machine on a single network that is physically routed, if you're using IPs and applying routing policies then it's a lot easier to use IPs, the way networks work you have a router which says "if you want any IP from 10.144.95.0 to 10.144.95.255 come to me!" and so on and so on until you build a routing table, that means you can route a group of IPs all at once, which you can't do with MAC addresses

#

IP to IP communication is a chain of MAC to MAC communication at each router

cedar forum
random vigil
#

I need some help with an AWS question. Is it okay for me to ask here?

cedar forum
random vigil
#

It's system design kind of question related to EC2 instances and Auto scaling
I'm preparing for SAA-C02 exam

elfin marten
#

hey anyone here who uses kali linux ?

random vigil
#

I hope that's okay?

ocean bay
ember ledge
cedar forum
cedar forum
#

with a wireless network, all traffic to all devices goes through the router (usually), with a wired network that's the same

#

the only case it might be different is if you've got a selection of devices plugged into a switch, one of which is a router, in that case, the local traffic can all be handled by the switch, only external traffic will hit the router

ocean bay
# cedar forum MAC addresses can only identify a single machine on a single network that is phy...

So I've got two interpretations of what you're saying haha. Is it

  1. That by having unique IPs WITHIN a network, when one device sends out a request, it can do so to multiple devices within the network because of the routing capabilities you mentioned
  2. That from a device within the same network, a router is able to send multiple requests to devices outside its networks at once due to routing capabilities you mentioned
cedar forum
#

that's fairly common in server networks, so at my job we've got a selection of devices plugged into a switch which use the switch to talk locally, and then a router which lets them talk to the internet, but no local traffic goes to that router

ocean bay
#

I assume you're saying 1. since it's more relevant to my question and because of what you just wrote haha

cedar forum
#

anything where a network is being traversed and going through a router is going to be a mix of IP to IP and MAC to MAC communication

#

say you've got network A which has device A, and network B that has device B

#

if device A wants to talk to device B then it's going to construct an IP packet with the source of A and dest of B

#

but the actual transmission will be:

  • mac address of device A to router of network A
  • mac from router of network A to mac address of network B
  • mac from router of network B to device B
ocean bay
#

Oooh so the MAC address is of the router not the device?

cedar forum
#

the router is a device and so has a mac address

#

the devices also have mac addresses

ocean bay
#

And so you could either have a switch or the router handle sending the transmission from device A to router A and router B to device B yeah?

#

Depending on your configuration

cedar forum
#

you can network together switches, yeah, and once you're out of home networks most of the internet is powered by switches rather than routers

ocean bay
#

Cool, so to reclarify routers can handle the transmission of data based on both MAC addresses and IPs then

cedar forum
#

routers are L3, so while you communicate with them using mac addresses like you would any device, they're interested in the L3 data because they need to know which MAC to route to next (next-hop) based on the destination IP

ocean bay
cedar forum
#

I mean that they're routing based on MAC address

ocean bay
#

Two different networks, Network A and network B. are able to route to each other using mac instead of IP address?

cedar forum
#

no, they need to use IP address, because they are not on the same physical link

#

basically, say you want to access a different network, your device will send that packet to your router, your router will then see "okay, the destination IP is 10.10.1.1" or whatever, it then looks at its routing table to find the next router IP it needs to send that onto (the next hop), then it'll find the MAC address and send it (because they'll be physically wired)

ocean bay
cedar forum
#

yes, because network A and B are not the same network, they need to use IPs to route between them

#

device A will send a packet destined for device B to router A, router A then looks up where to send packets for that network and finds the address of network B

#

MAC lookup, send data, router B then forwards it to device B

ocean bay
#

alright lets dive deeper into device A sending a packet to router A

#

So there are two options,

  1. there is a switch and it uses the source and dest mac to send the packet to router A, I get this
  2. If there is no switch how does the router, which we said is able to handle sending data within a network, handle receiving the data from device A
#

Im confused with number 2

#

If there is no switch what happens

cedar forum
#

the router acts as a switch, a router is just a less advanced L3 switch

#

device A creates a TCP/IP packet destined for device B, then it looks up the next hop that it needs to send to in order to get to device B

#

that'll be the default gateway most commonly, which is setup when you connect to the router using DHCP

#

it'll send out an ARP request saying "who has <router A ip>"

#

it'll get a response, and then it'll send the packet

ocean bay
#

I kinda get it, and this process you described would be the same with a normal switch instead of the router acting as the switch yea?

#

Wait up actually no,
with a switch, device A would send out an ARP request for router A's MAC address, then the switch would send the packet to router A.

without a switch, device A sends out an ARP request for router A's IP, then it just sends the packet to router A?

#

Sorry if im asking a bit too many questions haha all g if you're busy

ripe kayak
#

Hi, i just begun to learn about network, and I am trying to learn a bit about socket, watched some videos, tutorial and tried to work some code, even following the video, but couldn't make it work...

#

i made a server and a client

cedar forum
#

it's basically the same process though

ripe kayak
#

but they don't seem to connect

cedar forum
#

to a device it's no different

errant bayBOT
#

Hey @ripe kayak!

You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.

ripe kayak
#

Can someone show me why the error?

ocean bay
cedar forum
elder cobalt
#

@cloud spruce Hey, rnd been trying to figure out how to get the Y axis to work but no luck so far πŸ™ I tried checking if I could maybe make some relation with relative_distance but just couldn't with Y axis..

ocean bay
elder cobalt
# elder cobalt <@936769916072259654> Hey, rnd been trying to figure out how to get the Y axis t...

Also just did a bit more digging around it looks like there's a huge issue with not taking ping into account, what I've found out that the results between locally hosting vs joining a random empty server along with my 2nd client was huge. Like when I was messing around with velocity packets and adding relative_position = 100 only for velocity packets but leaving my xyz position coords the same it sorta collides with the car and I'm sent flying but

When I tried this theory on a server with maybe 100ms+ things started to vary, the observer car with only velocity changed was like in front of the car not colliding it sort of looked like it was but it wasn't.

Remember how I mentioned that if I keep xyz pos the same I teleport inside the car? When I tried it on the server it was just following behind way behind me without using relative_position.

You think there's a way to take ping into account?

#

Or maybe try to compensate ping so that it's the same distance for everyone?

elder cobalt
#

Oh well I guess we've already talked about this before but it looks like you need to do some prediction before hand with timestamps and ping which I am not sure how...

marsh glade
#

Guys is there any way to do data entry on a mobile app? (esspecially if the app does not have an API avaliable)

hushed birch
#

What's the best way to receive mail programmatically, preferably self-hosted? E.g. a Python email server

#

Should I write a program that receives SMTP connections? Do I put that behind a secure server like postfix, as a reverse proxy, similar to how I might put nginx in front of a Python web app?

#

Do I write a program that reads a mailbox? Or one that talks IMAP?

hushed birch
#

I can also have postfix etc feed the mails to a script

cunning garden
ember ledge
#

Any good suggestions for a networking related project?

hushed birch
hushed birch
#

I'm reading the sendgrid site and I can't figure out their pricing for inbound messages. It's clearly supported though, I have found the API docs

#

sketchy

cedar forum
hushed birch
#

"inbound parse"

cedar forum
#

huh

cedar forum
#

there are no quotas in our billing from what i can see, and receiving a bunch of emails didn't change anything in my stats portal

hushed birch
#

No free tier? Actually free?

#

that seems surprising, I mean I might only use sendgrid for receiving... they'll charge me nothing?

#

Amazon and mailgun charge

#

I might use that, free is hard to beat. I am already using it to send emails

cedar forum
#

no guarantees but

#

i can't see it anywhere in our billing

ember ledge
#

guys

#

i've got a question abou computer science : 'Logical orders'

#

what is the definition of "XOR"

#

wait sorry dudes

ember ledge
elder cobalt
#

Hello, I decided to ARP my phone using my PC as the MiTM and it sends requests to my router, when I load up wireshark I can see all the DNS requests going through just fine.

#

(192.168.0.124 is my phone's LAN ip-address and 192.168.0.1 is my router's address)

#

but when I launch up pydivert to see if I could edit packets using this code

with pydivert.WinDivert("ip.SrcAddr = 192.168.0.124 or ip.DstAddr = 192.168.0.124") as w:
    for packet in w:
        print(packet.payload)
        w.send(packet)

I only get these on my output?

#

any idea what could be the issue here? since it shows just fine in wireshark perhaps pydivert is not cut for it?

hushed birch
#

@elder cobalt Maybe you're not in promiscuous mode?

#

You want packets addressed to somebody else, you seem to only be capturing packets sent to everyone

elder cobalt
hushed birch
#

SSDP is multicast, 239.* are multicast addresses

elder cobalt
#

O hmm so maybe it looks like my phone sends packets to PC

PC sends it to everyone and then reaches the router?

Then router sends it to PC, PC sends it to everyone and then it reaches my phone?

elder cobalt
ember ledge
elder cobalt
#

@cloud spruce if you don't mind can you have a look with this code? https://paste.pythondiscord.com/loraneredu

It looks like I've forgotten to take account BatchedPositionUpdate
https://github.com/compujuckel/AssettoServer/blob/7bdcb4c7634b9c00ab889438919b189212e2e932/AssettoServer/Network/Packets/Outgoing/BatchedPositionUpdate.cs

The only thing different from the original modded server is that if it's not batched the one's highlighted will be the structure of that packet

So I made a new struct and named is as UpdateInB and included or conditions like UpdateIn or UpdateInB but I am not sure if this would be fine?

GitHub

Custom Assetto Corsa server with focus on freeroam - AssettoServer/BatchedPositionUpdate.cs at 7bdcb4c7634b9c00ab889438919b189212e2e932 Β· compujuckel/AssettoServer

#

0x48 identifies as a mega packet

elder cobalt
#

not sure how else could I make a condition over here that if it's a megapacket (batched) don't use the last two fields

#

then I don't need to include UpdateInB

#

using the or condition seems to be buggy as well

cloud spruce
#

i haven't had time too look at this much for almost a week now

elder cobalt
#

because then I'd need to create target and targetB πŸ˜…

#

pretty sure this part of the code is right

                elif packet.payload[0:1] == b"\x48": # Modded server version B
                    offset = 8
                    for _ in range(packet.payload[1]):
                        metrics.updates_in += 1
                        if (
                            len(packet.payload) >= offset + update_record_size
                            and packet.payload[offset : 1 + offset] == session_id
                        ):
                            metrics.matches_in += 1
                            target_data = packet.payload[offset: offset + update_record_size]
                            target = None
                        offset += update_record_size

But **target **and **update_record_size **are problematic (they both have UpdateIn or UpdateInB statement)

so whenever I am printing out the position it works fine for few seconds then it shoots out a random value then goes back to being normal. I tried to just cut off UpdateIn and replace it with UpdateInB everywhere and it worked properly without any of those randomness so there seems to be an issue when I am trying to combine both of these classes with an or statement only

cloud spruce
# elder cobalt ah no issues, I'm checking if there's any fix apart from rewriting two separate ...

what a mess those last two fields are
in the stock packets it looks to be first performance_delta then gas
and in custom (modded server) updates it looks like it's the other way around
while in batched updates they are not even present at all
so we actually have three different data structures coming over the network only for position updates from the server
and one more structure for position updates from the client, so four in total

elder cobalt
# cloud spruce what a mess those last two fields are in the stock packets it looks to be first ...

Yeah was confusing for me at first but as far as I know I've asked the creator and he said to follow the CSPPositionUpdate.cs struct and for packets which start with 0x46 (which in our case looks like both stock server as well as the modded server sends in version B) It'll have performance delta and gas struct and they will follow a length of 61 (which we had made originally for the stock server but can be used with modded as well) he said when the data/payload starts with 0x48 we have to ignore performance delta and gas and it goes by 0x48,timestamp,ping,counter and then PositionUpdate struct

cloud spruce
cloud spruce
#

i'm thinking about just skipping them in the data structure and then hard code the offsets for the record byte length for each type of packet
that would require using a bytearray slice for all but the batched updates in the "mega" packet structure

elder cobalt
#

gas isn't really needed as well as performance_delta

cloud spruce
elder cobalt
#

nah regarding that post which I made how my car always used to lag behind

#

it looks like assigning the target's timestamp the same as mine some how fixes the issue which I am not sure how

cloud spruce
elder cobalt
#

When I assign observer timestamp to target timestamp my car seems to teleport sporadically everywhere

#

But the reverse works just fine

#

Decided to yoink in pak_sequence_id as well didn't notice any change but for the sake of it added in

elder cobalt
#

I've searched it online but just couldn't find any post about it