πŸ’Ύ Archived View for airmack.de β€Ί single β€Ί da3919672bd6fb2a152d08298f5e1a0e3cb53f778418c25750baef1ea3… captured on 2023-12-28 at 15:21:54. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2021-12-17)

-=-=-=-=-=-=-


β–‘β–ˆβ–€β–ˆβ–‘β–€β–ˆβ–€β–‘β–ˆβ–€β–„β–‘β–ˆβ–„β–ˆβ–‘β–ˆβ–€β–ˆβ–‘β–ˆβ–€β–€β–‘β–ˆβ–‘β–ˆβ–‘β–‘β–‘β–‘β–ˆβ–€β–„β–‘β–ˆβ–€β–€
β–‘β–ˆβ–€β–ˆβ–‘β–‘β–ˆβ–‘β–‘β–ˆβ–€β–„β–‘β–ˆβ–‘β–ˆβ–‘β–ˆβ–€β–ˆβ–‘β–ˆβ–‘β–‘β–‘β–ˆβ–€β–„β–‘β–‘β–‘β–‘β–ˆβ–‘β–ˆβ–‘β–ˆβ–€β–€
β–‘β–€β–‘β–€β–‘β–€β–€β–€β–‘β–€β–‘β–€β–‘β–€β–‘β–€β–‘β–€β–‘β–€β–‘β–€β–€β–€β–‘β–€β–‘β–€β–‘β–€β–‘β–‘β–€β–€β–‘β–‘β–€β–€β–€


CCCac Clubstatus

Aus der Kategorie Open Source

Das ist der aktuelle Code um den Clubstatus abzufragen:

Code


#!/usr/bin/env python
# -*- coding: latin-1 -*-
## VERSION: Freitag 23 Dezember 2011, 23:27

import base64
import socket
import ssl
import sys

import gtk
import pygtk

pygtk.require("2.0")
import gobject


class status_checker:
  def __init__(self):
    self.statusIcon = gtk.StatusIcon()
    self.statusIcon.set_from_file("undefined.ico")
    self.status = -1
    self.statusIcon.set_visible(True)

    self.HOST = "status.voidspace.aachen.ccc.de"

    # temp
    USER = "user"
    # passwort="password"
    self.ARG = base64.b64encode(USER + ":" + passwort)
    self.check_status()

    self.statusIcon.connect("popup-menu", self.callback)

  def __del__(self):
    pass

  def exit(self, widget, data=None):
    gtk.main_quit(0)

  def callback(self, icon, button, time):
    menu = gtk.Menu()
    menuitem = gtk.MenuItem("Toggle Status")
    menuitem.connect("activate", self.toggle_status)
    menu.append(menuitem)
    menuitem = gtk.MenuItem("Refresh")
    menuitem.connect("activate", self.check_status)
    menu.append(menuitem)
    menu.append(gtk.SeparatorMenuItem())
    menuexit = gtk.MenuItem("Exit")
    menuexit.connect("activate", self.exit)
    menu.append(menuexit)
    menu.show_all()
    menu.popup(
      None, None, gtk.status_icon_position_menu, button, time, self.statusIcon
    )

  def check_announce(self, widget=None):
    pass

  def change_status(self, status):
    try:
      s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
      ssl_sock = ssl.wrap_socket(
        s, ca_certs="/etc/ca_certs_file", cert_reqs=ssl.CERT_NONE
      ) ##we don't care about certs
      ssl_sock.connect((self.HOST, 443))
      if status:
        MESSAGE = (
          """POST /status HTTP/1.1\r\nHost: """
          + self.HOST
          + """\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: 4\r\nAuthorization: Basic """
          + self.ARG
          + """\r\n\r\nopen\r\n\r\n"""
        )
      else:
        MESSAGE = (
          """POST /status HTTP/1.1\r\nHost: """
          + self.HOST
          + """\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: 6\r\nAuthorization: Basic """
          + self.ARG
          + """\r\n\r\nclosed\r\n\r\n"""
        )
      ssl_sock.write(MESSAGE)
      data = ssl_sock.read()
      if data.find("Status: 201"):
        self.status = status
        if status:
          self.statusIcon.set_from_file("opened.ico")
          print "Status has been changed to open"
        else:
          self.statusIcon.set_from_file("closed.ico")
          print "Status has been changed to closed"
      else:
        print "Status has not been changed"
      s.close()
    except:
      print "There hast been a problem"

  def toggle_status(self, widget=None):
    self.change_status(not self.status)

  def check_status(self, widget=None, data=None):
    try:
      s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
      ssl_sock = ssl.wrap_socket(
        s, ca_certs="/etc/ca_certs_file", cert_reqs=ssl.CERT_NONE
      ) ##we don't care about certs
      ssl_sock.connect((self.HOST, 443))
      ssl_sock.write(
        """GET /status HTTP/1.1\r\nHost: """
        + self.HOST
        + """\r\nAuthorization: Basic """
        + self.ARG
        + """\r\n\r\n"""
      )
      data = ssl_sock.read()
      print data
      if not data.find("Status: 200") == -1:
        data = ssl_sock.read()
        print data
        if not data.find("closed") == -1:
          self.status = 0
          self.statusIcon.set_from_file("closed.ico")
        else:
          self.status = 1
          self.statusIcon.set_from_file("opened.ico")
      else:
        self.statusIcon.set_from_file("undefined.ico")
        self.status = -1
      s.close()
      return True
    except:
      self.statusIcon.set_from_file("undefined.ico")
      self.status = -1
      print "Warning connection error!"
      return True

  def run(self):
    self.timer = gobject.timeout_add(1000 * 10 * 60, self.check_status)
    gtk.main()


def main(argv=None):
  A = status_checker()
  A.run()
  sys.exit(0) ##everything done


if __name__ == "__main__":
  main(sys.argv)


Latest article

Fix for zfs-dkms-git in arch for kernel 5.15.7 erstellt am 11. December 2021

Project gemini erstellt am 13. Februar 2021

Eat Sleep PWN Repeat erstellt am 07. Dezember 2020

Physico-chemically motivated parameterization and modelling of real-time capable lithium-ion battery models: a case study on the Tesla Model S battery erstellt am 06. Dezember 2020

Breaking out of cisco anyconnect no local network restriction erstellt am 8. April 2018

Insomni Hack 2015(Lost In Memories) writeup erstellt am 23. Maerz 2014

ruCTF 2014(Pidometer) writeup erstellt am 21. Dezember 2014

Footer

Hauptseite

Impressum

Übersicht

Bio