Skip to content

Instantly share code, notes, and snippets.

@Icekhaos
Last active August 23, 2018 17:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Icekhaos/61d8c700deb342abd12440e8c572cc1f to your computer and use it in GitHub Desktop.
Save Icekhaos/61d8c700deb342abd12440e8c572cc1f to your computer and use it in GitHub Desktop.
# Tiny file cutter; made to excise bytes from files
# Date code: 150418
# Written over a weekend by Cheetah Pixie as a reverse-engineering tool
#
# Copyright (C) 2018 Icekhaos
#
# This program is free software: you can redistribut it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have recieved a copy of the GNU General Public License
# along with this prgram. If not, see <http://www.gnu.org/licenses/>.
#
ifn = input ("File name to open: ")
start = int (input ("Starting character #: "))
end = int (input ("Ending character #: "))
ofn = input ("File name to save as (empty input defaults to \"output\": ")
if not ofn:
ofn = "output"
with open (ifn, "rb") as text:
cut = text.read()[start:end]
with open (ofn, "wb") as outf:
outf.write(cut)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment