Jump to content
Tuts 4 You

Programming & Coding

47 files

  1. Understanding Windows Shellcode

    The purpose of this document is to familiarize or refresh the reader with the techniques used to write reliable shellcode for Windows. The reader is expected to be familiar with IA32 assembly on at least a conceptual level. It is also recommended that the reader take some time to review some of the items in the bibliography. Aside from that, the only other requirement is the desire to learn. Many portions of this document have been covered elsewhere before but, to the author’s satisfaction, have not been compiled into an easily understandable format for beginners and tinkerers alike. For this reason the author hopes that the reader walks away with a more centralized point of reference with regards to the topic of Windows shellcode. This document will focus both on Windows 9x and Windows NT based versions with more emphasis on the latter.

    22 downloads

    0 comments

    Submitted

  2. Verified Just-In-Time Compiler On x86

    This paper presents a method for creating formally correct just-in-time (JIT) compilers. The tractability of our approach is demonstrated through, what we believe is the first, verification of a JIT compiler with respect to a realistic semantics of self-modifying x86 machine code. Our semantics includes a model of the instruction cache. Two versions of the verified JIT compiler are presented: one generates all of the machine code at once, the other one is incremental i.e. produces code on-demand. All proofs have been performed inside the HOL4 theorem prover.

    12 downloads

    0 comments

    Submitted

  3. Visual Basic Quick Reference

    A quick instruction set reference guide for Visual Basic.

    17 downloads

    0 comments

    Submitted

  4. What's Decidable About Arrays

    Motivated by applications to program verification, we study a decision procedure for satisfiability in an expressive fragment of a theory of arrays, which is parameterized by the theories of the array elements. The decision procedure reduces satisfiability of a formula of the fragment to satisfiability of an equisatisfiable quantifier-free formula in the combined theory of equality with uninterpreted functions (EUF), Presburger arithmetic, and the element theories. This fragment allows a constrained use of universal quantification, so that one quantifier alternation is allowed, with some syntactic restrictions. It allows expressing, for example, that an assertion holds for all elements in a given index range, that two arrays are equal in a given range, or that an array is sorted. We demonstrate its expressiveness through applications to verification of sorting algorithms and parameterized systems. We also prove that satisfiability is undecidable for several natural extensions to the fragment. Finally, we describe our implementation in the VC verifying compiler.

    10 downloads

    0 comments

    Submitted

  5. Win32 Assembler Coding for Crackers v11

    Most (if not all) of the best hackers, crackers and reverse engineers are also programmers. It is probably impossible to learn RCE well without any knowledge of programming and many of the oldest txt files on cracking would urge the student - "first go away and learn assembler, then come back and read this". This is truer now than ever before as packers and executable protectors use increasingly complex and diverse methods of preventing unpacking, debugging and rebuilding. This has led to cracking groups coding custom tools rather than just relying on debugger, disassembler and tools like ImpREC. It has also led to loaders becoming increasingly popular, a fact echoed by the excellent Cracking with Loaders series from ARTeam. These however are not so easy to understand for beginners without any prior coding knowledge.

    I have written this tutorial to fill the gap between the complete beginner and the advanced tutorials on loaders, tracers, etc. Similarly, whilst console based apps and tools may be functional they are far from pretty so my second aim was to illustrate how easy it is to create GUI apps in assembler.

    In the spirit of the assembler programming and reversing communities I have re-used and adapted code from a wide variety of sources which are remembered with full credit and gratitude where possible.

    41 downloads

    0 comments

    Submitted

  6. Win32 Programmers Reference Guide

    Microsofts Win32 programmers API reference guide.

    29 downloads

    0 comments

    Submitted

  7. Win32 Programmers Reference Guide Big.rar

    Microsofts Win32 programmers API reference guide with added API guides for accessing other useful Microsoft functions.

    27 downloads

    0 comments

    Submitted

  8. Win32 Programmers Reference Guide CHM

    Microsoft's Win32 programmers API reference guide in CHM format.

    26 downloads

    0 comments

    Submitted

  9. Win32Asm Tutorial

    First a short introduction about this tutorial. Win32asm isn't a very popular programming language, and there are only a few (good) tutorials. Also, most tutorials focus on the win32 part of the programming (i.e. the win API, use of standard windows programming techniques and so on), not on the assembler programming itself, using opcodes, registers etc. Although you can find these things in other tutorials, these tutorials often explain DOS programming. This sure helps you to learn the assembly language, but with programming in windows, you don't need to know about DOS interrupts and port in/out functions. In windows, there's the windows API that supplies standard functions you can use in your program, but more on this later. The goal of this tutorial is to explain win32 programming in assembler as well as assembly language itself.

    22 downloads

    0 comments

    Submitted

  10. Windows Programming in Assembler

    Paper covering programming aspects in assembler (HLA).

    17 downloads

    0 comments

    Submitted

  11. x86 Opcode Structure and Instruction Overview

    Two nice and simple opcode tables from Daniel Plohmann and Ange Albertini.

    20 downloads

    0 comments

    Submitted

  12. PureBasic - A Beginners Guide

    This book provides a quick introduction to the PureBasic programming language. PureBasic's popularity has increased significantly in the past few years, being used for many purposes such as rapid software prototyping, creation of commercial applications and games, Internet CGI applications, while some people just use it for small utilities. This book has been written, with the complete novice in mind. We all need to start somewhere and I believe PureBasic is a fantastic first leap into the programming world. With PureBasic becoming more and more widely used, many people are starting out and finding they need the occasional push in the right direction or need an explanation of a certain feature or oddity. This book is to guide novices through their first steps and to give the seasoned programmer a quick overview of the language.

    Although this book covers the essentials of the PureBasic language, I've kept this book's scope quite narrow to make sure it's not information overload for new users. Sometimes this text will refer to concepts and syntax in a simplistic way to be used as a stepping stone to more advanced texts or as a complement to the existing PureBasic helpfile.

    For example I won't talk much about how easy it is to use DirectX or OpenGL directly in PureBasic, otherwise this book would be triple in size and although topics such as pointers, threads and the Win32 API is talked about later in this book, don't expect too many fancy examples as I've only given an overview to such advanced topics.

    PureBasic raises the bar to not only what a Basic language should be but also what all languages should be. Clean, uncluttered syntax, small compiled executable files and a fantastically active community of programmers. Hopefully this book will give you a clear understanding of the core features of PureBasic and the design goals and philosophies behind its creation and hopefully make you want to learn more.

    Despite this books limited scope, I think you will find this a great first book on PureBasic which will also give you a solid grounding on programming in general if you were to migrate to other languages. You will learn everything you need to start writing useful standalone programs. By the time you've finished this book, you will have learned not only the essentials of the language itself, but also how to apply that knowledge to day-to-day tasks. You will also be better equipped to tackle more advanced topics as they come your way.

    17 downloads

    0 comments

    Submitted

  13. PureBasic - Reference Manual v5.20

    PureBasic is an ”high-level” programming language based on established ”BASIC” rules. It is mostly compatible with any other ”BASIC” compiler, whether it’s for the Amiga or PC format. Learning PureBasic is very easy! PureBasic has been created for beginners and experts alike. Compilation time is extremely fast. This software has been developed for the Windows operating system. We have put a lot of effort into its realization to produce a fast, reliable and system-friendly language.
    The syntax is easy and the possibilities are huge with the ”advanced” functions that have been added to this language like pointers, structures, procedures, dynamic linked-lists and much more. For the experienced coder, there are no problems gaining access to any of the legal OS structures or Windows API objects.
    PureBasic is a portable programming language which currently works on AmigaOS, Linux, MacOS X and Windows computer systems. This means that the same code can be compiled natively for the OS and use the full power of each. There are no bottlenecks like a virtual machine or a code translator, the generated code produces an optimized executable.
    The main features of PureBasic
    - x86, x64, 680x0 and PowerPC support
    - Built-in arrays, dynamic linked-lists, complex structures, pointers and variable definitions
    - Supported types: Byte (8-bit), Word (16-bit), Long (32-bit), Quad (64-bit), Float (32-bit), Double
    (64-bit) and Characters
    - User defined types (structures)
    - Built-in string types (characters), including ascii and unicode
    - Powerful macro support
    - Constants, binary and hexadecimal numbers supported
    - Expression reducer by grouping constants and numeric numbers together
    - Standard arithmetic support in respect of sign priority and parenthesis: +, -, /, *, and, or, «, »
    - Extremely fast compilation
    - Procedure support for structured programming with local and global variables
    - All Standard BASIC keywords: If-Else-EndIf, Repeat-Until, etc
    - Specialized libraries to manipulate BMP pictures, windows, gadgets, DirectX, etc
    - Specialized libraries are very optimized for maximum speed and compactness
    - The Win32 API is fully supported as if they were BASIC keywords
    - Inline Assembler
    - Precompiled structures with constants files for extra-fast compilation
    - Configurable CLI compiler
    - Very high productivity, comprehensive keywords, online help
    - System friendly, easy to install and easy to use

    12 downloads

    0 comments

    Submitted

  14. PureBasic - Survival Guide

    The PureBasic Survival Guide is a non-official set of pages to help newcomers and converts starting with PureBasic.

    22 downloads

    0 comments

    Submitted

  15. Silences Programming Tour with MASM32

    In this series I will teach you how to code in MASM32. Everything is very well explained, each line, each word and each API. This tour is called "General Edition" simply because I will learn you general MASM32 programming. In the examples I will teach you how to code a simple messagebox up to a MP3 music player.

    Content: (including source)

    1. Introduction, Setup & Skeleton of Exe
    2. Our first MessageBox
    3. Our first DialogBox
    4. DialogBox in Detail
    5. Default toolbar controls part 1 (RichEdit, Trackbar, Radiobutton & Checkbox)
    6. Default toolbar controls part 2 (Progressbar & Tabs)
    7. Default toolbar controls part 3 (Listbox)
    8. Default DialogBoxes (Color, Font, Open, Save, Print, Page-Setup, Find-Text, Find-Replace)
    9. Simple file management
    10. Showing Bitmap image & Playing mp3 files
    11. Windows Registry + Final words

    23 downloads

    0 comments

    Submitted

  16. Simply FPU

    The FPU, also known as a co-processor, used to be an option when the first PCs came on the market. Modern PCs are now all provided with a co-processor. Although the original PC-XT has evolved considerably over the years, the FPU itself has not changed appreciably during that same period. Apart from a few minor instructions having been added, the main improvement has been the extended range of some of the existing instructions.

    The entire set of assembler instructions for the FPU is relatively small and could be memorized rapidly. Learning which parameter(s) can be used with each instruction should take only slightly longer. The main difficulty is in developing sound programming techniques to avoid some of the pitfalls peculiar to the FPU.

    The main purpose of this document is to show that using the FPU can be relatively easy with minimal effort. Once the basics have been mastered, any computation however complex can be performed.

    The first chapter describes the internals of the FPU and how they function. Some of this knowledge is an absolute necessity to use the FPU properly or help later in understanding the outcome of some of the instructions. This is followed by a chapter describing the various data types which can be used with some of the instructions, including a detailed review of the floating point data formats.

    The FPU instructions are then discussed in detail in the following chapters which regroup them according to some "biased" criteria. Although some description of each instruction is available in the Fphelp.hlp file provided with MASM32, a more in-depth review is provided with more tangible examples of their usage.

    The final chapter provides a fully commented example of a semi-complex computation.

    It should be noted that this document has been prepared according to the syntax used by MASM. Although most other assemblers/compilers should have a similar syntax for the FPU instruction mnemonics, their syntax may differ for the addressing mode of memory variables. It is also known that some of the instructions used without explicit parameters are not supported by some of the other assemblers/compilers.

    10 downloads

    0 comments

    Submitted

  17. The Art of Assembly

    Welcome! The Art of Assembly Language Programming is now available in a special edition for Windows. This edition employs the HLA (High Level Assembler) language that makes learning assembly language easier than ever before. If you're comfortable with C/C++ or Pascal, you'll be writing assembly in no time.

    22 downloads

    0 comments

    Submitted

  18. The Semantics of x86-CC Multiprocessor Machine Code

    Multiprocessors are now dominant, but real multiprocessors do not provide the sequentially consistent memory that is assumed by most work on semantics and verification. Instead, they have subtle relaxed (or weak) memory models, usually described only in ambiguous prose, leading to widespread confusion.

    We develop a rigorous and accurate semantics for x86 multiprocessor programs, from instruction decoding to relaxed memory model, mechanised in HOL. We test the semantics against actual processors and the vendor litmus-test examples, and give an equivalent abstract-machine characterisation of our axiomatic memory model. For programs that are (in some precise sense) data-race free, we prove in HOL that their behaviour is sequentially consistent. We also contrast the x86 model with some aspects of Power and ARM behaviour.

    This provides a solid intuition for low-level programming, and a sound foundation for future work on verification, static analysis, and compilation of low-level concurrent code.

    11 downloads

    0 comments

    Submitted

  19. Understanding Code

    A nice paper explaining code.

    21 downloads

    0 comments

    Submitted

  20. Understanding the Low Fragmentation Heap

    Over the years, heap exploitation has continued to increase in difficulty, along with the complexity of heap algorithms and data structures. Due to anti-exploitation counter measures and lack of comprehensive heap knowledge, reliable exploitation has severely declined. Understanding of the inner workings of a memory manager can be the difference between unreliable failure and precise exploitation.

    Beginning with Vista, the Low-Fragmentation heap has been the default front-end memory manager for the Windows operating system. This new front-end manager brought with it a different set of data structures and algorithms that replaced the look-aside list. This new system also changed the way back-end memory management works as well. All of this material must be reviewed to understand the repercussions of creating and destroying objects within an application on Windows 7.

    13 downloads

    0 comments

    Submitted

  21. Programming From The Ground Up

    I love programming. I enjoy the challenge to not only make a working program, but to do so with style. Programming is like poetry. It conveys a message, not only to the computer, but to those who modify and use your program. With a program, you build your own world with your own rules. You create your world according to your conception of both the problem and the solution. Masterful programmers create worlds with programs that are clear and succinct, much like a poem or essay.

    One of the greatest programmers, Donald Knuth, describes programming not as telling a computer how to do something, but telling a person how they would instruct a computer to do something. The point is that programs are meant to be read by people, not just computers. Your programs will be modified and updated by others long after you move on to other projects. Thus, programming is not as much about communicating to a computer as it is communicating to those who come after you. A programmer is a problem-solver, a poet, and an instructor all at once. Your goal is to solve the problem at hand, doing so with balance and taste, and teach your solution to future programmers. I hope that this book can teach at least some of the poetry and magic that makes computing exciting.

    Most introductory books on programming frustrate me to no end. At the end of them you can still ask "how does the computer really work?" and not have a good answer. They tend to pass over topics that are difficult even though they are important. I will take you through the difficult issues because that is the only way to move on to masterful programming. My goal is to take you from knowing nothing about programming to understanding how to think, write, and learn like a programmer. You won't know everything, but you will have a background for how everything fits together.

    14 downloads

    0 comments

    Submitted

  22. Programming on Parallel Machines

    Why is this book different from all other parallel programming books? It is aimed more on the practical end of things, in that:
    There is very little theoretical content, such as O() analysis, maximum theoretical speedup, PRAMs, directed acyclic graphs (DAGs) and so on. Real code is featured throughout. We use the main parallel platforms - OpenMP, CUDA and MPI - rather than languages that at this stage are largely experimental or arcane. The running performance themes - communications latency, memory/network contention, load balancing and so on - are interleaved throughout the book, discussed in the context of specific platforms or applications. Considerable attention is paid to techniques for debugging. The main programming language used is C/C++, but some of the code is in R, which has become the pre-eminent language for data analysis. As a scripting language, R can be used for rapid prototyping. In our case here, it enables me to write examples which are much less less cluttered than they would be in C/C++, thus easier for students to discern the fundamental parallelixation principles involved. For the same reason, it makes it easier for students to write their own parallel code, focusing on those principles. And R has a rich set of parallel libraries.

    It is assumed that the student is reasonably adept in programming, and has math background through linear algebra. An appendix reviews the parts of the latter needed for this book. Another appendix presents an overview of various systems issues that arise, such as process scheduling and virtual memory.

    It should be note that most of the code examples in the book are NOT optimized. The primary emphasis is on simplicity and clarity of the techniques and languages used. However, there is plenty of discussion on factors that affect speed, such cache coherency issues, network delays, GPU memory structures and so on.

    Here's how to get the code files you'll see in this book: The book is set in LaTeX, and the raw .tex files are available in http://heather.cs.ucdavis.edu/~matloff/158/PLN. Simply download the relevant file (the file names should be clear), then use a text editor to trim to the program code of interest.

    In order to illustrate for students the fact that research and teaching (should) enhance each other, I occasionally will make brief references here to some of my research work.

    Like all my open source textbooks, this one is constantly evolving. I continue to add new topics, new examples and so on, and of course fix bugs and improve the exposition. For that reason, it is better to link to the latest version, which will always be at http://heather.cs.ucdavis.edu/~matloff/158/PLN/ParProcBook.pdf, rather than to copy it.

    For that reason, feedback is highly appreciated. I wish to thank Stuart Ambler, Matt Butner, Stuart Hansen, Bill Hsu, Sameer Khan, Mikel McDaniel, Richard Minner, Lars Seeman and Johan Wikstr'om for their comments. I'm also very grateful to Professor Hsu for his making available to me advanced GPU-equipped machines.

    11 downloads

    0 comments

    Submitted

  23. PC Assembly Language

    The purpose of this book is to give the reader a better understanding of how computers really work at a lower level than in programming languages like Pascal. By gaining a deeper understanding of how computers work, the reader can often be much more productive developing software in higher level languages such as C and C++. Learning to program in assembly language is an excellent way to achieve this goal. Other PC assembly language books still teach how to program the 8086 processor that the original PC used in 1981! The 8086 processor only supported real mode. In this mode, any program may address any memory or device in the computer. This mode is not suitable for a secure, multitasking operating system. This book instead discusses how to program the 80386 and later processors in protected mode (the mode that Windows and Linux runs in). This mode supports the features that modern operating systems expect, such as virtual memory and memory protection.

    18 downloads

    0 comments

    Submitted

  24. PicoWeb P-Code

    A pcode instruction interpreter was developed for the PicoWeb Server. The use of a custom pcode provides:

    - program code simplification,
    - the option to execute program code out of EEPROM (including external serial EEPROM), and
    - in many cases a reduction in program code size as compared to native code.

    Code simplification is achieved because the p-code makes no reference to native registers, and because the pcode "virtual machine" uses 16-bit wide data types for most operands. Pcode execution from EEPROM is possible because the pcode "instruction pointer" is 16 bits wide, more than is needed to address the program memory in the Atmel microcontroller. Therefore, the "extra" address bits can be used to indicate that the next pcode instruction should be fetched from EEPROM, and not from the microcontroller's internal program memory.

    9 downloads

    0 comments

    Submitted

  25. Platform-Independent Programs

    Given a single program (i.e., bit string), one may assume that the program's behaviors can be determined by first identifying the native runtime architecture and then executing the program on that architecture. In this paper, we challenge the notion that programs run on a single architecture by developing techniques that automatically create a single program string that a) runs on different architectures, and b) potentially has different behaviors depending upon which architecture it runs on. At a high level, a primary security implication is that any program analysis done on a program must only be considered valid for the assumed architecture. Our techniques also introduce a new type of steganography that hides execution behaviors. In order to demonstrate our techniques, we implement a system for generating platform-independent programs for x86, ARM, and MIPS. We use our system to generate real platform-independent programs.

    9 downloads

    0 comments

    Submitted


×
×
  • Create New...