This forum is in archive mode. You will not be able to post new content.

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 - Lupus

Pages: [1]
1
General discussion / Re: Evilzone Chess Tournament?
« on: May 28, 2013, 01:24:18 AM »
I'd be up for this.  I'd also be willing to whip up the program for the name picking.

2
C - C++ / [C++] String Class
« on: May 27, 2013, 11:19:10 PM »
We were given this assignment as a way to practice pointers, operator overloading, etc.  Essentially, we created our own string class with several different functions within it.


String1030.h
Code: [Select]

// String1030.h
//@author Lupus
// Header for class that will handle an implementation
// of strings.


#ifndef STRING1030_H
#define STRING1030_H


#include<iostream>


using std::ostream;
using std::istream;
using std::endl;
using std::cerr;


class String1030
{


  public:
     
    String1030(const char *buf=0);
 
    String1030(const String1030& oldstring);
 
    ~String1030();


    String1030& operator=(const String1030& right);


    char& operator[](int index);


    int getSize(void) const;
    void setSize(int newsize);
    const char *getString();
    void setString(const char *carray);




  private:
    char *buffer;
    int mysize;


};




#endif


String1030.cpp
Code: [Select]

//String1030.cpp
//@author Lupus
//March 27th, 2013


#include "String1030.h"


//Basic constructors
String1030::String1030(const char *buf): mysize(0)
{
setString(buf);
}


String1030::String1030(const String1030& oldstring): mysize(0)
{
if(oldstring.getSize() <= 0)
{
setSize(0);
}
else
{
setSize(oldstring.getSize());
for(int i = 0; i < (mysize+1); i++)
{
buffer[i] = oldstring.buffer[i];
}
}
}


//Reallocates the memory.
String1030::~String1030()
{
delete [] buffer;
}


//Overloads the = operator, causing one string to be set to another.
String1030& String1030::operator=(const String1030& right)
{
if(!(&right == this))
{
if(right.getSize() <= 0)
{
setSize(0);
}
else
{
setSize(right.getSize());
for(int i = 0; i < (mysize+1); i++)
{
buffer[i] = right.buffer[i];
}
}
}


return *this;
}


//Deals with operator overloading of the [] operator.
char& String1030::operator[](int index)
{
if(!(index < 0 || index >= mysize))
{
return buffer[index];
}
else return buffer[0];
}


//Simple accessor function for size.
int String1030::getSize(void) const
{
return mysize;
}


//Resetting size of a string. 
void String1030::setSize(int newsize)
{
if(!(newsize < 0))
{
if(buffer != NULL)
{
mysize = newsize;
buffer = new char[mysize+1];
}
else
{
mysize = newsize;
buffer = new char[mysize+1];
}


}
}


//A simple accessor function to return the string.
const char* String1030::getString()
{
return buffer;
}


//Handles setting a new string.
void String1030::setString(const char *carray)
{
int index(0);
if(carray != 0)
{
while(*(carray + index) != '\0')
{
index++;
}
mysize = index;
buffer = new char[mysize+1];
for(int i = 0; i < (mysize+1); i++)
{
buffer[i] = carray[i];
}
}
}


Example test file (only thing given to us in this assignment, so I do not take credit for this code):
Code: [Select]

// StringTest.cpp
// Testing program for the String1030 class.
#include<iostream>
#include "String1030.h"


using std::cout;
using std::cin;


int main()
{
  // check the constructors
  String1030 s("My string");
  String1030 t(s);
  String1030 x;


  char in_buf[256];




  cout << "S size(): " << s.getSize() << endl;
  cout << "T size(): " << t.getSize() << endl;
  cout << "X size(): " << x.getSize() << endl;


  for(int i=0;i<t.getSize();i++)
    cout << t[i];
  cout << endl;


  s[2]='5';


  for(int i=0;i<s.getSize();i++)
    cout << s[i];
  cout << endl;


  // check the assignment operator
  x=s;
  cout << "X: " << x.getString() << endl;


  // check the size reset.
  x.setSize(30);


  cin >> in_buf;
  x.setString(in_buf);
  cout <<  "\nx: " << x.getString() << endl;




  //more checks on resize


  //set to a negative value, nothing should change
  s.setSize(-8);
  cout << "S size(): " << s.getSize() << endl;


  //set to 0, should be 0
  s.setSize(0);
  cout << "S size(): " << s.getSize() << endl;


  //read into the 0 length array should NOT have an error
  //and should NOT transfer any characters. Output should not
  //have any errors either.
  cin >> in_buf;
  s.setString(in_buf);
  cout << "S after cin>>: " << s.getString() << endl;


  //reset to something larger than 0
  s.setSize(10);
  cout << "S size(): " << s.getSize() << endl;


  //read should work now
  cin >> in_buf;
  s.setString(in_buf);
  cout << "S after cin>>: " << s.getString() << endl;


  //now the assignment return value


  x=t=s;


  cout << "T: " << t.getString() << endl;
  cout << "X: " << x.getString() << endl;




  return 0;


}


It was interesting having to essentially build our own version of the string class.  This was probably the hardest assignment of the semester.  We had been introduced to pointers literally that day, and had yet to learn operator overloading.  Definitely learned a lot from grinding through this though.


Lupus

3
Operating System / Re: What do you think of Kali as a OS?
« on: May 27, 2013, 05:08:27 PM »
Personally, I oppose this. yes, arch can be frustrating, but it's worth it in the end, you end up with an operating system, that you know a few basic console commands on. if you use ubuntu, you don't get dug in to using command line at the start, so unless you actively try to, you won't learn about it at all. whereas with a distro like arch, you start to understand what you are doing, and how it works. all this, and it is itself much smaller. and as it is starting from pure command line, it's easy to put in place the DE or WM of your choice. or.. as in my case.. put in place a couple, so i can use whichever suits my mood.


That is true that you can get down and dirty with Arch from the start, and I agree with most things you said, but I also know it's pretty easy to muck up your computer if you botch the install. 


I guess it ultimately depends on learning style and ambition.  In my case, I wanted to get used to the feel of Linux and basic CLI stuff before I dove into something insane in the beginning like Arch.  That would probably have intimidated me and made me run back to Windows. 


I'd say if people want to try Arch, they should start it up in VMWare or VirtualBox or something the first time and run through the install.

4
Hacking and Security / OverTheWire WarGames Site
« on: May 27, 2013, 06:08:47 AM »
Mentioned this site on IRC, and there was interest from a couple people on there so I thought it would be beneficial for me to post it here as it seems not everyone knows about it.


Link:
OverTheWire (http://www.overthewire.org/wargames/)


This site has practice for essentially every kind of hacking and pentest you could think of.  A team I'm on at my University used this site as the main practice tool, and we placed incredibly well in an international CTF competition. 


The site also updates regularly, and continues to add more challenges and expand on their current ones.  There's many different categories, and I don't know anyone who has finished them all yet.  So even you experts out there should be kept pretty busy with this site.


Hope you all enjoy.


Lupus

5
Operating System / Re: What do you think of Kali as a OS?
« on: May 26, 2013, 06:46:05 AM »
@OP i suggest this for a future linux distro https://www.archlinux.org/ . I mean i'd say just go ahead and start messing with it, but it can be very difficult at times. At the least it's good to know about, a little reading can't hurt :p.


OP, Archlinux is pretty hardcore.  I'm not saying don't use it, but do be prepared to want to throw your computer through a shredder.

If you want a soft introduction to Linux with very easy install/uninstall, try Wubi.  It's an installer for Ubuntu/Kubuntu/Mythbuntu/etc that takes you step-by-step through partitioning, setting up your user account, etc.  Pretty damn hard to mess up, and will give you a chance to feel what a dual-boot is like and get used to a Linux environment.  I highly recommend it.

6
C - C++ / Re: What to use?
« on: May 26, 2013, 06:16:26 AM »
... but it's a mess to learn programming on because of #include <windows.h>.


My University used Visual Studio 2010/12 for my C++ course, and we literally never saw #include <windows.h>.  All our programs ran perfectly well.  In fact, our professor would use Linux and gVim in class and programs transferred from VS2012 to gVim and vice-versa performed just fine. 


@Silenthunder:


While using a full IDE may not be completely necessary, I would recommend getting used to one before you begin your course.  As I stated above, my university used VS2012.  I have a friend at another Uni who used Netbeans.  Those two are pretty common for C++, so I'd imagine it will be one of those.  Even if you don't use it full-time during the summer, do take some time to get acquainted and comfortable with one or both of those.  That will give you a leg-up in the course.

Pages: [1]


Want to be here? Contact Ande, Factionwars or Kulverstukas on the forum or at IRC.