Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Python 

Extension Spoofer w/ GUI

I recently started working on a lot of random projects since I have more free time, and I have made a few cool programs so far.
Today, I am releasing my extension spoofer. It isn't my prettiest code, but it works perfectly.

This works by using the unicode right-to-left-override character, so it is not an exploit or anything, but it should fool some people.

Here is a screenshot:
Spoiler (Click to View)

Here is the source code:
http://pastebin.com/ip07ZX41
[The code tags mess up the indentation]
Code
import shutil
import time
import os
import wx

class Spoofer(wx.Frame):
    extensions = {'.exe' : 'exe',
      '.jpg' : 'gpj',
      '.png' : 'gnp',
      '.pdf' : 'fdp',
      '.mp4' : '4pm',
      '.avi' : 'iva',
      '.txt' : 'txt'}

    def __init__(self):
      self.InitUI()

    def InitUI(self):
      wx.Frame.__init__(self, None, -1, 'Extension Spoofer', size=(335,100), style=wx.DEFAULT_FRAME_STYLE ^ wx.RESIZE_BORDER ^ wx.MAXIMIZE_BOX)

      self.panel = wx.Panel(self)
      self.SetBackgroundColour('#ECF0F1')

      wx.StaticText(self, -1, '   File:', pos=(16,11))
      self.file_input = wx.TextCtrl(self, -1, pos=(48,8), size=(267,24), style=wx.TE_READONLY)
      self.file_input.SetValue('PRESS OPEN TO CHOOSE A FILE')

      wx.StaticText(self, -1, '    Ext:', pos=(16,38))
      self.ext = wx.ComboBox(self, -1, '', pos=(48,35), choices=self.extensions.keys(), style=wx.CB_READONLY)

      self.open_file = wx.Button(self, 101, 'Open', pos=(136,34))
      self.Bind(wx.EVT_BUTTON, self.OpenFile, id=101)

      self.spoof = wx.Button(self, 102, 'Spoof', pos=(228,34))
      self.Bind(wx.EVT_BUTTON, self.SpoofFile, id=102)

      self.Centre()
      self.Show()

    def OpenFile(self, event):
      default_path = os.path.splitdrive(os.getenv('WINDIR'))[0] + '\\'
      file_dialog = wx.FileDialog(self, 'Open File', default_path, '', 'All Files (*.*)|*.*', wx.OPEN)

      if file_dialog.ShowModal() == wx.ID_OK:
      self.fname = str(file_dialog.GetFilename())
      self.fdir = str(file_dialog.GetDirectory())
      self.curr_extension = os.path.splitext(self.fname)[1]

      self.file_input.SetValue(os.path.join(self.fdir, self.fname))
      return 0
      else:
      return 1

    def SpoofFile(self, event):
      self.error = 0

      if self.file_input.GetValue() == '' or self.file_input.GetValue() == 'PRESS OPEN TO CHOOSE A FILE':
      wx.MessageBox('Please choose the file to be spoofed.', 'Error!', wx.OK | wx.ICON_ERROR)
      self.error += 1

      if self.ext.GetValue() == '':
      wx.MessageBox('Please choose the extension to use.', 'Error!', wx.OK | wx.ICON_ERROR)
      self.error += 1

      if self.error != 0:
      return 1

      dir_dialog = wx.DirDialog(self, 'Choose A Backup Location', self.fdir)

      if dir_dialog.ShowModal() == wx.ID_OK:
      self.bak_dir = str(dir_dialog.GetPath())
      self.bak_path = os.path.join(self.bak_dir, (self.fname + '.bak'))

      self.ext_type = self.ext.GetValue()
      self.path = str(self.file_input.GetValue())

      try:
      shutil.copyfile(self.path, self.bak_path)
      except IOError:
      wx.MessageBox('An IO error hase occured.\nTry running as administrator.', 'Error!', wx.OK | wx.ICON_ERROR)
      return 1
      else:
      return 1

      time.sleep(2)

      try:
      new_fname = os.path.splitext(self.fname)[0] + u'\u202E' + self.extensions.get(self.ext_type) + self.curr_extension
      os.chdir(self.fdir)
      os.rename(self.path, new_fname)

      wx.MessageBox('Successfuly Spoofed Extension.', 'Success!', wx.OK | wx.ICON_INFORMATION)
      return 0
      except:
      wx.MessageBox('An error during spoofing has occured.\nTry running as administrator.', 'Error!', wx.OK | wx.ICON_ERROR)
      return 1

if __name__ == '__main__':
    app = wx.App()
    Spoofer()
    app.MainLoop()

Note that wxPython is required for this to work.
To add more extensions, simply add your desired extension to the dicitionary as a key - and for the value add the extension backwards, without the dot.

If you enjoy this program, it would be appreciated if you posted or left a vouch so other people can see this too.

Thanks!
RTLO character spoofing. Brings back memories of me doing this in C++. And you even used wxPython instead of PyQT. I love it.
(Jul 1, 2015 12:44 PM)Mouse❤️ Wrote:  RTLO character spoofing. Brings back memories of me doing this in C++. And you even used wxPython instead of PyQT. I love it.

Thanks! I was actually thinking of using PyQt but I'm much more comfortable with wxPython. 😁
This one looks nice man :) well done.
(Jul 9, 2015 12:44 PM)MrCortex Wrote:  This one looks nice man :) well done.

Thanks! I really appreciate it.
This is that file changing exploit that i learnt 1-2 years ago. so this app makes that task easier. wow. amazing. o_O the core of this app is that (u202E) and ofcourse python. haha xD (y)

EDIT: just took the source from pastebin, i am sure this will help me someday.. Thank-you so much for sharing it. really appreciate your efforts! ^_~
(Jul 10, 2015 12:03 AM)4h35i13n46u7 Wrote:  This is that file changing exploit that i learnt 1-2 years ago. so this app makes that task easier. wow. amazing. o_O the core of this app is that (u202E) and ofcourse python. haha xD (y)

EDIT: just took the source from pastebin, i am sure this will help me someday.. Thank-you so much for sharing it. really appreciate your efforts! ^_~

Thanks, and no problem. I hope you find it useful! 😁
Wow very nice. This will make stuff a lot easier. Good job.
(Jul 11, 2015 01:04 PM)@beef Wrote:  Wow very nice. This will make stuff a lot easier. Good job.

Thanks for the feedback. I really appreciate it!


Possibly Related Threads...
Thread / Author Replies Views Last Post
[.NET] by Dinnemok34763Jun 23, 2018 10:25 PM 3 267 Jun 23, 2018 10:25 PM
Last Post: n0$f3ratu$
[.NET] by xeinebiuJan 12, 2016 02:14 PM 14 1,533 Jan 12, 2016 02:14 PM
Last Post: xeinebiu
[.NET] by ChessoMar 11, 2015 08:50 AM 7 288 Mar 11, 2015 08:50 AM
Last Post: ElementalTree