News: 1up Discord VOIP
Invite Code: https://discord.gg/VPv9JhP

Author Topic: 1up Gadget (Sidebar Server Monitor) [official release]  (Read 12560 times)

0 Members and 1 Guest are viewing this topic.

Offline Pyrite[1up]

  • *[1up] Dev Admin
  • [1up] Dev Team
  • [1upZ] NMRiH Admin
  • Posts: 1,560
  • Karma: 147
  • Since: 08/11/2009
    YearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYears
Re: 1up Gadget (Sidebar Server Monitor) [official release]
« Reply #30 on: September 04, 2010, 03:51:38 AM »
I do not understand why either of you are not using the getstatus command to get the info you want and format it however you want instead of trying to parse remote php files which puts a strain on our site that is not needed. All the info you need can be obtained using the getstatus command this is how sites like game tracker and others like it work so use the tools that are already available to you instead of making life more difficult for yourselves.

As far as connecting to a server from within an application goes that is extremely simple to do as well, simply call the urt executable with the connect and ip parameters like this (path/to/urt_executable.exe connect  127.0.0.1) you don't even need to supply a port if the server you are connecting to is using the default port (ie 27960) but if it's not then you just add the port after the ip like this (127.0.1.0:55555)

Like I said all of the things your trying to accomplish can be done in much simpler ways so do yourselves a favor and search google for "quake 3 rcon protocol" and you should be good to go once you understand the basics which is extremely easy to do (1 line of code to be exact)

Good Luck,
Tesla[1up]

I already helped him with most of that. The problem is the language of choice he is implementing, as a shell script, I would have no idea how to open sockets in bash script. I told it would be easier to parse the html, but for the vent status and onlinemods, he is pointing it to my server. Oh, and it doesn't put any strain on our server, it's no different than going to the servers page in a web browser yourself, instead, he is using curl, which is basically a command line web browser. The cool thing is, now that he has written this, we can now make a desktop widget for the Mac OSX Dashboard that uses his script as a backend. I think Dougy is going to look into this task.
« Last Edit: September 04, 2010, 06:33:52 AM by Pyrite[1up] »
•·.· ́ ̄`·.·•"Most Likely to Pillage the Global Village"•·.· ́ ̄`·.·•


Offline Dougy

  • Posts: 594
  • Karma: -6
  • Since: 17/01/2010
    YearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYears
    • TheOMFG Music
Re: 1up Gadget (Sidebar Server Monitor) [official release]
« Reply #31 on: September 04, 2010, 05:55:41 AM »
To install KD's Lush Script (Non-perfect) but hey it works ;)

Pyrite: http://kazeshima.net/scripts/1ups
Pyrite: open a terminal
Pyrite: type
Pyrite: curl http://kazeshima.net/scripts/1ups > 1ups
Pyrite: chmod +x 1ups
Pyrite: ./1ups

They are the Mac Commands I used..................... Thanks Kd for this wonderful app, I would like to know if you would keep working on this as im hoping to make this into a widget to use on mac :D <3 much love KD and wonderful script :D

Offline KD197

  • Posts: 671
  • Karma: 28
  • Since: 20/06/2010
    YearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYears
Re: 1up Gadget (Sidebar Server Monitor) [official release]
« Reply #32 on: September 04, 2010, 09:51:50 AM »
Sorry Tesla, like Pyrite said, I did ask about direct info from the server after Googling for "query urban terror server stats" returned nothing of use.
Curl only fetches the HTML from the page, causing no more load than viewing that page directly. I didn't realise the reason you directed me to HTML was due to language restrictions Pyrite, I've actually dabbled in bash sockets a bit when writing a bash irc client. Do Macs have nc/netcat by default?
I didn't realise my script was going to be used as a backend, I believe there are some simple GUI toolkits for Linux I might be able to use...
Also, the script in it's current state doesn't work well with the Mac versions of the tools I've used, but it's easily fixed. I was going to make this interactive, in the way that you double click a desktop icon and it launches a terminal for you, but I'll hold off on that until I know if Dougy can make a GUI for it.
« Last Edit: September 04, 2010, 09:59:49 AM by KD197 »

Not-so-1337-hax0rz: awsdgiaygveiujgfahiy, killer, [K1L]ShAd0W[GER], [51]Usage (impersonator), 1Lexa8, Redeye, sid, ASTROKILLA, bar, mody, [R:K]BatistaBomB, revenger, [58f]gojan, imaidiot, [DOA]Arik, sn4k3, Broajer, HACKER, DDMX, dopey

"yeah, I googled "mod reveal 67" to find out what it does and the top links were from 1up" - SlimPickins[1up]

Offline Dougy

  • Posts: 594
  • Karma: -6
  • Since: 17/01/2010
    YearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYears
    • TheOMFG Music
Re: 1up Gadget (Sidebar Server Monitor) [official release]
« Reply #33 on: September 04, 2010, 10:11:39 AM »
Also, the script in it's current state doesn't work well with the Mac versions of the tools I've used, but it's easily fixed. I was going to make this interactive, in the way that you double click a desktop icon and it launches a terminal for you, but I'll hold off on that until I know if Dougy can make a GUI for it.

Bull**** im saying that to you kd the current version works like a dream kd sorry for the profanity but its so F'ing good i could marry your script XD

Offline KD197

  • Posts: 671
  • Karma: 28
  • Since: 20/06/2010
    YearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYears
Re: 1up Gadget (Sidebar Server Monitor) [official release]
« Reply #34 on: September 04, 2010, 12:20:58 PM »
That's strange, Pyrite said that it wasn't interpreting newline characters (\n in GNU sed) properly on his system; Macs have BSD sed, which is slightly different. Let me know if you can't get a widget-type thing working and I'll see if I can do anything.
At some point I'd like to see if I can use the getstatus command like Tesla said.
Oh and can a Mac user confirm the status of launching into servers please?

Once I sort out the newline character thing, I think I can speed the player search up again.
Originally it was parallel downloading and parsing, but it caused 32 processes to spawn simultaneously, and this set off the anti-forkbomb restrictions I have on my rig. So I switched to sequential download and parse - the idea is to have parallel downloads and sequential parsing, to speed it back up.
Parallel download and parsing was ~0.65s, sequential download and parse ~3.80s, so I'm hoping the parallel downloads will bring the time down below 3s.
« Last Edit: September 04, 2010, 12:56:08 PM by KD197 »

Not-so-1337-hax0rz: awsdgiaygveiujgfahiy, killer, [K1L]ShAd0W[GER], [51]Usage (impersonator), 1Lexa8, Redeye, sid, ASTROKILLA, bar, mody, [R:K]BatistaBomB, revenger, [58f]gojan, imaidiot, [DOA]Arik, sn4k3, Broajer, HACKER, DDMX, dopey

"yeah, I googled "mod reveal 67" to find out what it does and the top links were from 1up" - SlimPickins[1up]

Offline Pyrite[1up]

  • *[1up] Dev Admin
  • [1up] Dev Team
  • [1upZ] NMRiH Admin
  • Posts: 1,560
  • Karma: 147
  • Since: 08/11/2009
    YearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYears
Re: 1up Gadget (Sidebar Server Monitor) [official release]
« Reply #35 on: September 04, 2010, 03:15:26 PM »
That's strange, Pyrite said that it wasn't interpreting newline characters (\n in GNU sed) properly on his system; Macs have BSD sed, which is slightly different. Let me know if you can't get a widget-type thing working and I'll see if I can do anything.
At some point I'd like to see if I can use the getstatus command like Tesla said.
Oh and can a Mac user confirm the status of launching into servers please?

Once I sort out the newline character thing, I think I can speed the player search up again.
Originally it was parallel downloading and parsing, but it caused 32 processes to spawn simultaneously, and this set off the anti-forkbomb restrictions I have on my rig. So I switched to sequential download and parse - the idea is to have parallel downloads and sequential parsing, to speed it back up.
Parallel download and parsing was ~0.65s, sequential download and parse ~3.80s, so I'm hoping the parallel downloads will bring the time down below 3s.

Oh, and SlimPickins and I agreed, the way you are launching UrT in your script is totally gridbag. I would just specify the path to Urt at the top (put the default), and the user can change it to meet their needs. No need to spawn a separate X session just to run UrT either. You can simply detect if X is running, and if so, run it on that display, otherwise your script can just say "You need to be running X in order to play Urban Terror" or something.
•·.· ́ ̄`·.·•"Most Likely to Pillage the Global Village"•·.· ́ ̄`·.·•


Offline Pyrite[1up]

  • *[1up] Dev Admin
  • [1up] Dev Team
  • [1upZ] NMRiH Admin
  • Posts: 1,560
  • Karma: 147
  • Since: 08/11/2009
    YearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYears
Re: 1up Gadget (Sidebar Server Monitor) [official release]
« Reply #36 on: September 04, 2010, 04:02:01 PM »
Scratch that, I was able to get it working with 3 lines of bash code (i had no idea you can do sockets in bash).
Code: [Select]
exec 3<>/dev/udp/208.43.15.85/27960
echo -e "\xff\xff\xff\xffgetstatus">&3
cat <&3

:D
•·.· ́ ̄`·.·•"Most Likely to Pillage the Global Village"•·.· ́ ̄`·.·•


Offline KD197

  • Posts: 671
  • Karma: 28
  • Since: 20/06/2010
    YearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYears
Re: 1up Gadget (Sidebar Server Monitor) [official release]
« Reply #37 on: September 04, 2010, 04:10:10 PM »
Bash sockets are the win dude. Nice one for working it out, I can get working on it straight away. This should make Tesla happy  8)
Also, the way the game is being launched is like what you're describing - the function "URT" at the top has the path, and is being called later in the script, with the +connect and IP/port info. Unless you meant something else?

Not-so-1337-hax0rz: awsdgiaygveiujgfahiy, killer, [K1L]ShAd0W[GER], [51]Usage (impersonator), 1Lexa8, Redeye, sid, ASTROKILLA, bar, mody, [R:K]BatistaBomB, revenger, [58f]gojan, imaidiot, [DOA]Arik, sn4k3, Broajer, HACKER, DDMX, dopey

"yeah, I googled "mod reveal 67" to find out what it does and the top links were from 1up" - SlimPickins[1up]

Offline Dougy

  • Posts: 594
  • Karma: -6
  • Since: 17/01/2010
    YearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYears
    • TheOMFG Music
Re: 1up Gadget (Sidebar Server Monitor) [official release]
« Reply #38 on: September 04, 2010, 05:09:16 PM »
i hacked my sed remember lol :D so.............

Offline KD197

  • Posts: 671
  • Karma: 28
  • Since: 20/06/2010
    YearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYears
Re: 1up Gadget (Sidebar Server Monitor) [official release]
« Reply #39 on: September 04, 2010, 05:11:32 PM »
How the hell do you hack sed? You mean you installed GNU sed probably.
Oh and Pyrite, I got the socket redirection working, and stopped it from hanging the script too. ;)
I'll get started with sed tomorrow to parse all the data and make it look nice. :P

Not-so-1337-hax0rz: awsdgiaygveiujgfahiy, killer, [K1L]ShAd0W[GER], [51]Usage (impersonator), 1Lexa8, Redeye, sid, ASTROKILLA, bar, mody, [R:K]BatistaBomB, revenger, [58f]gojan, imaidiot, [DOA]Arik, sn4k3, Broajer, HACKER, DDMX, dopey

"yeah, I googled "mod reveal 67" to find out what it does and the top links were from 1up" - SlimPickins[1up]

Offline Dougy

  • Posts: 594
  • Karma: -6
  • Since: 17/01/2010
    YearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYears
    • TheOMFG Music
Re: 1up Gadget (Sidebar Server Monitor) [official release]
« Reply #40 on: September 04, 2010, 05:27:36 PM »
How the hell do you hack sed? You mean you installed GNU sed probably.
Oh and Pyrite, I got the socket redirection working, and stopped it from hanging the script too. ;)
I'll get started with sed tomorrow to parse all the data and make it look nice. :P

No coz you cant install it properly on our macs you have to like rewrite/replace the existing code with the new crappier looking one the tutorial supplies XD so yer in terms that aint hacking its basically following a tutorial............. LOL

Offline Pyrite[1up]

  • *[1up] Dev Admin
  • [1up] Dev Team
  • [1upZ] NMRiH Admin
  • Posts: 1,560
  • Karma: 147
  • Since: 08/11/2009
    YearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYears
Re: 1up Gadget (Sidebar Server Monitor) [official release]
« Reply #41 on: September 04, 2010, 05:50:24 PM »
I just thought of an idea, we should put our server definitions in a RSS feed, for the Mac OSX Dashboard Widget to use, and also for the Windows Vista/7 Gadget to use, so if we add/change a 1up server, the desktop widgets will be updated automatically.
•·.· ́ ̄`·.·•"Most Likely to Pillage the Global Village"•·.· ́ ̄`·.·•


Offline KD197

  • Posts: 671
  • Karma: 28
  • Since: 20/06/2010
    YearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYears
Re: 1up Gadget (Sidebar Server Monitor) [official release]
« Reply #42 on: September 04, 2010, 06:44:41 PM »
Good idea, I dunno what RSS syntax is like as I've never bothered with it but as long as I can parse it, I'm game. If the script is going to use an RSS feed for server IPs, I'd either have to have a switch in the script for the user to update a local file containing the IPs, from which the main script would read every time, or have the RSS downloaded every time it's run. I don't want to use up more bandwidth than necessary, even if its just a few kilobytes. It all adds up.
I guess I could use sed to make the script edit itself lol. But I don't know how that would work in terms of different install locations. The home dir is a good place if it's going to be run directly by the user, whereas somewhere like /usr/bin would be more suitable if it's just going to be a backend.

Not-so-1337-hax0rz: awsdgiaygveiujgfahiy, killer, [K1L]ShAd0W[GER], [51]Usage (impersonator), 1Lexa8, Redeye, sid, ASTROKILLA, bar, mody, [R:K]BatistaBomB, revenger, [58f]gojan, imaidiot, [DOA]Arik, sn4k3, Broajer, HACKER, DDMX, dopey

"yeah, I googled "mod reveal 67" to find out what it does and the top links were from 1up" - SlimPickins[1up]

Offline Tesla[1up]

  • *Administrative Leave
  • [1up] Dev Admin
  • [1up] UrT Admin
  • Posts: 480
  • Karma: 106
  • Since: 07/07/2009
    YearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYears
Re: 1up Gadget (Sidebar Server Monitor) [official release]
« Reply #43 on: September 04, 2010, 07:16:47 PM »
Quote
Shell Script¶

If you are using a Linix/Unix/Solaris/BSD box then you can get the status of the server on the command line.

Rcon Status (password required)

printf '\xFF\xFF\xFF\xFFrcon <PASSWORD> status\n' | nc -u -n -w 1 <SERVER_IP> <SERVER_PORT> | sed -ne ':x;/\xFF/{N;s/\xFF\xFF\xFF\xFFprint\n//;tx};/^$/d;p'

Basic Status (no password required)

printf '\xFF\xFF\xFF\xFFgetstatus\n' | nc -u -n -w 1 <SERVER_IP> <SERVER_PORT>

(Replace <PASSWORD>, <SERVER_IP>, <SERVER_PORT> above with the actual values)

And what I meant by strain on the website is that by using the page grabbing method he was using and only grabbing the info every 5 seconds or so would generate over 123 Gigs of bandwidth per month for just one person and if you multiply that number by just 25% of the clan (actual users who may use the app) then your looking at roughly 1.4 Terabytes of bandwidth per month which to me is a great deal of bandwidth for one application to use in a months time that is all I was saying.

Tesla[1up]
« Last Edit: September 04, 2010, 07:36:25 PM by Tesla[1up] »
"May I suggest the footing of your ass" Red Forman

Offline KD197

  • Posts: 671
  • Karma: 28
  • Since: 20/06/2010
    YearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYears
Re: 1up Gadget (Sidebar Server Monitor) [official release]
« Reply #44 on: September 05, 2010, 04:30:10 AM »
Whilst I see what you're getting at, that kind of usage model is far from what the script does. It only pulls in the pages when specifically requested, which would be the same as viewing the pages on the site, and the only increased usage comes from the player search, which one could argue is no different from someone looking at all the pages to see if someone is there. Of course, one could argue that the script makes it more convenient, and therefore more likely that people are going to search for players. I see your point, I never wanted to waste bandwidth, but I don't think it'd be anywhere near as bad as you've calculated - no-one is going to run the script every 5 seconds 24 hours a day every day of the month.
But hey, Pyrite and myself worked out how to get the info from the servers directly last night so no worries dude!

Not-so-1337-hax0rz: awsdgiaygveiujgfahiy, killer, [K1L]ShAd0W[GER], [51]Usage (impersonator), 1Lexa8, Redeye, sid, ASTROKILLA, bar, mody, [R:K]BatistaBomB, revenger, [58f]gojan, imaidiot, [DOA]Arik, sn4k3, Broajer, HACKER, DDMX, dopey

"yeah, I googled "mod reveal 67" to find out what it does and the top links were from 1up" - SlimPickins[1up]