Jump to content

Coniesan

Seller
  • Posts

    25
  • Joined

  • Last visited

  • Feedback

    0%

Posts posted by Coniesan

  1. lol sry @all but try this ;)
    Go to char.cpp (serverside)
    there u have your "INSERT" Query

    	    // Insert
    	    char szQuery2[512];
    	    snprintf(szQuery2, sizeof(szQuery2), "INSERT INTO %soffline_shop_npc(owner_id, sign, name, time, x, y, z, mapIndex, channel) VALUES(%u, '%s', '%s', %d, %ld, %ld, %ld, %ld, %d)", get_table_postfix(), GetPlayerID(), c_pszSign, GetName(), iTime, GetX(), GetY(), GetZ(), GetMapIndex(), g_bChannel);
    	    DBManager::Instance().DirectQuery(szQuery2);
    
     

    replace it with:

    	    // Insert
    	    char szSign2[SHOP_SIGN_MAX_LEN+1];
    	    DBManager::instance().EscapeString(szSign2, sizeof(szSign2), c_pszSign, strlen(c_pszSign));
    	    char szQuery2[512];
    	    snprintf(szQuery2, sizeof(szQuery2), "INSERT INTO %soffline_shop_npc(owner_id, sign, name, time, x, y, z, mapIndex, channel) VALUES(%u, '%s', '%s', %d, %ld, %ld, %ld, %ld, %d)", get_table_postfix(), GetPlayerID(), szSign2, GetName(), iTime, GetX(), GetY(), GetZ(), GetMapIndex(), g_bChannel);
    	    DBManager::Instance().DirectQuery(szQuery2);
    
     

    the "DBManager::instance().EscapeString()" methode should be default in your db.h
    So have fun ;)

     

     

    3I8hw0c.pngsMjtEPM.png

     

    • Love 2
  2. It looks nice :D But u have to be careful, cause of Copyright of Nintendo...

    If you (perhaps) remember, some months ago, someone started a project on kickstarter, for a Minecraft movie!

    Notch stopped this project after a few hours....!

  3. Try this:

    env | grep -i shell

    the output should be:

    SHELL=/bin/csh

    But the default output (for normal useres) is:

    SHELL=/bin/sh

    Execute this in command line:

    chsh -s /bin/csh

    And the prompt will change after su or relogg on the user ;)
    Like this:

    shell_change.png

  4. I thought, this are the basics you should know if you work with the command line...!

    You can use almost everything on linux systems, too (some even on windows)

     

    If someone have a command, or an other question, how he/she can do anything with command line, I'll in the future add commands and/or ways how to do or deal with it

    #Edit: Thanks, my mistake, edited it ;)

  5. Hey @ all,

    I hope a thread like this doesn't exist right now!

    Introduction:

    Here u'll find some basics you should know, and some things which makes your life easier!

    So let's go:

    First of all, the command-line! If you often uses putty (or s.th. else) it helped me a lot to change the default prompt!

    Here my favorite:

    Spoiler

    291517comando.png.ea06da395d4b7ec60119b9

    You only have to edit the .cshrc file in your <user> (for example /root or /home/<user>) directory!

    Uncomment the given prompt line, or delete it and put the following instead:

    
    set prompt = "%{033[31m%}%n %{033[1;33m%}%~ %{033[0m%}>"

    Second thing is the SCP Service! Most of u know "winscp" which is based on the unix scp service!

    Spoiler

    With this, you easy can transfer files between you servers and you don't have to copy it first on your computer!

    For example, we take the file.tgz from out SOURCE server, to our system into the direcory we are at the moment:

    
    scp -P <port> <user>@xxx.xxx.xx.xxx:<path_to_file> <path_where_to_save_file>

    If you are using a SSH-Key on the external server, you have to edit your command, and add the .ppk file to it:

    
    scp -P <port> -i <path_to_private_key> <user>@xxx.xxx.xx.xxx:<path_to_file> <path_where_to_save_file>

    (the ppk should have 600 rights!)

    If you need an example:

    Spoiler

    Take game.tgz from 10.2.0.1 in the /home directory to /usr/home

    
    
    scp -P 22 [email protected]:/home/game.tgz /usr/home/

    Take game.tgz from 10.2.0.1 in the /home directory to /usr/home, with the ppk in /home/my.ppk

    
    
    scp -P 22 -i /home/my.ppk [email protected]:/home/game.tgz /usr/home/

    Here some helpful commands:

    Spoiler

    -----------------------------------------------------------------------------------------------------------------

    whereis

    If you don't know, where you can find a package you can use it, to get the exact path

    
    root / >whereis apache22
    apache22: /usr/ports/www/apache22
    

    -----------------------------------------------------------------------------------------------------------------

    df

    The df command shows you some informations about your hard disk space (the parameter -h is useful here)

    
    root / >df -h
    Filesystem     Size    Used   Avail Capacity  Mounted on
    /dev/da0s1a     17G    2.9G     13G    18%    /
    devfs          1.0k    1.0k      0B   100%    /dev
    /dev/da1s1d     77G    4.0k     71G     0%    /usr/home
    

    -----------------------------------------------------------------------------------------------------------------

    ps

    ps shows you all running processes a user running at the moment!

    You get the pid, the status, the time, a process is running, and the command or service which is executed!

    [for Metin, if your came is named "game" and your server is running, you'll see there ./game for example)

    
    root / >ps
      PID  TT  STAT      TIME COMMAND
      872  v0  Is+    0:00.00 /usr/libexec/getty Pc ttyv0
    13771   0  Ss     0:00.04 -csh (csh)
    13824   0  R+     0:00.00 ps
    

    use the parameter -al, to get ALL processes listed

    -----------------------------------------------------------------------------------------------------------------

    kill

    With kil you can kill a process by it's pid!

    important parameters are -1 and -9!

    -1: The kill stops the process and wait for the response, that it done everything well (saving files or s.th. else)

    -9: The kill stops the process without asking anything! Just die is the slogan!

    
    kill -9 <pid>

    If you don't know the pid (but the name) or if you wanna kill a view processes with the same name (example Metin2 where you have the "game" for each Channel/Core) you can use killall!

    Here same system with -1 and -9

    
    killall -9 game

    -----------------------------------------------------------------------------------------------------------------

    ls

    This command shows you every file in a directory.

    
    ls -G

    is painting files with special endings. Use the parameter -al to get ALL files listed ( .file are not listed with the single ls command)

    -----------------------------------------------------------------------------------------------------------------

    cat

    It shows you the content of a file, without opening it in an editor!

    In combination with the grep command, it's very easy to find a special sting in a file!

    
    cat CONFIG
    CHANNEL: 1
    CHECK_MULTIHACK: 0
    COMMON_SQL: localhost mt2 mt2!@# common
    DB_ADDR: 127.0.0.1
    DB_PORT: 13000
    empire_whisper: 1
    HOSTNAME: Game1
    LOG_SQL: localhost mt2 mt2!@# log
    MAP_ALLOW: 1 3 21 23 41 43 61 62 63 64 65
    ....(and so on)

    -----------------------------------------------------------------------------------------------------------------

    grep|egrep

    It can be used additionaly to an other command or alone to "grep" s.th. out, what you are looking for!

    For example (combination with "cat"):

    
    cat CONFIG | grep "PORT"
    DB_PORT: 15000
    P2P_PORT: 161000
    PORT: 13000
    

    Or if you looking for a file with includes a special string:

    
    grep -r "text string to search” directory-path

    -----------------------------------------------------------------------------------------------------------------

    cp/mv

    With cp you can copy with mv move a file!

    
    cp [source] [target]
    mv [source] [target]
    

    To copy/move a whole directory, you need to add the parameter -R

    
    cp -R [source] [target]
    mv -R [source] [target]
    

    -----------------------------------------------------------------------------------------------------------------

    rm

    Use it to delete files

    
    rm <file>

    If you need to delete a whole direcotory add the parameter -rf (it is much more faster then deleting it by FileZilla or WinSCP)

    
    rm -rf <file/directory>

    -----------------------------------------------------------------------------------------------------------------

    touch/mkdir

    To create a new file without editing it, use touch. With mkdir you create a new directory.

    
    touch <file-path>
    mkdir <directory-path>
    

    -----------------------------------------------------------------------------------------------------------------

    tar

    For packing or extracting with compression you can use this basic command.

    I allways use it the the following parameters:

    To pack:

    
    tar czvf datei.tgz directory

    To extract:

    
    tar xzvf file.tgz

    -----------------------------------------------------------------------------------------------------------------

    pkg_info

    This command shows you every package you have installed

    -----------------------------------------------------------------------------------------------------------------

    find

    with find, you are able to search quickly for a file by its name and get the exact path.

    For example "syserr"

    
    find / -name "syserr"

    You are also able to execute a command if it finds s.th.

    For example, we delete the syserr while searching, if we find one

    
    find . -name syserr -exec rm {} ;

    To get all important CPU informations, you can use this:

    Spoiler
    
    sysctl -a | egrep -i 'hw.machine|hw.model|hw.ncpu'
    hw.machine: amd64
    hw.model: Intel(R) Xeon(R) CPU E5-2640 0 @ 2.50GHz
    hw.ncpu: 3
    hw.machine_arch: amd64

    If you wanna know s.th. about your used memory(RAM/SWAP) and so on, you can install "free" (which is a basic command on linux)

    It's an perl script, so you have to install perl if you doesn't

    Spoiler
    
    fetch http://www.cyberciti.biz/files/scripts/freebsd-memory.pl.txt
    mv freebsd-memory.pl.txt /usr/local/bin/free
    chmod +x /usr/local/bin/free

    Command (possible output):

    
    free
    SYSTEM MEMORY INFORMATION:
    mem_wire:         390885376 (    372MB) [ 18%] Wired: disabled for paging out
    mem_active:  +    805543936 (    768MB) [ 38%] Active: recently referenced
    mem_inactive:+    809562112 (    772MB) [ 39%] Inactive: recently not referenced
    mem_cache:   +     31989760 (     30MB) [  1%] Cached: almost avail. for allocation
    mem_free:    +     29843456 (     28MB) [  1%] Free: fully available for allocation
    mem_gap_vm:  +       581632 (      0MB) [  0%] Memory gap: UNKNOWN
    -------------- ------------ ----------- ------
    mem_all:     =   2068406272 (   1972MB) [100%] Total real memory managed
    mem_gap_sys: +     63307776 (     60MB)        Memory gap: Kernel?!
    -------------- ------------ -----------
    mem_phys:    =   2131714048 (   2032MB)        Total real memory available
    mem_gap_hw:  +     15769600 (     15MB)        Memory gap: Segment Mappings?!
    -------------- ------------ -----------
    mem_hw:      =   2147483648 (   2048MB)        Total real memory installed
    
    SYSTEM MEMORY SUMMARY:
    mem_used:        1276088320 (   1216MB) [ 59%] Logically used memory
    mem_avail:   +    871395328 (    831MB) [ 40%] Logically available memory
    -------------- ------------ ----------- ------
    mem_total:   =   2147483648 (   2048MB) [100%] Logically total memory

    One more thing is the traffic!

    Spoiler

    To get a screen like this:

    291440darkstat.png.78ad8a24fd9a8b2492485

    1. Install:

    
    cd /usr/ports/net-mgmt/darkstat && make install clean

    2. Enable in /etc/rc.conf our example network interface is em0

    
    darkstat_enable="YES"
    darkstat_interface="em0"
    

    3. start the service

    
    service darkstat start

    4. start a session (port is not for listening It's for the web-application)

    
    darkstat -p <port> -b <server_ip> -i <network_interface>

    you will see your stats on: <server_ip>:<port>

    For example:

    
    darkstat -p 10010 -b 10.5.0.2 -i em0

    now go on http://10.5.0.2:10010

    Kind regards

    • Confused 1
    • Good 1
    • Love 9
  6. Hey @ all

    For that people who are using Debian 6 and Apache could this be very nice!

    People who are using nginx, you are normaly safe, but if you fuck your configs up, slowloris can be a problem for you, too ;)

     

    1. What is slowloris?

    Slowloris is a perl script, which allows you to open hundreds of sessions on your webserver and hold them open!

    So your webserver crashes if it reaches ~700 connections at the same time 

     

    2. How to fix it?

    1. Download and extract the mod

    wget ftp://ftp.monshouwer.eu/pub/linux/mod_antiloris/mod_antiloris-0.4.tar.bz2
    tar -jxvvf mod_antiloris-0.4.tar.bz2
    cd mod_antiloris-0.4/
     

    2. Install the compile kit:

    apt-get install gcc apache2-threaded-dev
    3. compile mod_antiloris

    /usr/bin/apxs2 -i -c mod_antiloris.c
    4. import the mod to apache

    echo "LoadModule antiloris_module /usr/lib/apache2/modules/mod_antiloris.so" > /etc/apache2/mods-available/antiloris.load
    a2enmod antiloris
    5. restart it

    /etc/init.d/apache2 restart
    I hope you enjoy it!

    Kind regards

    • Love 7
  7. @iRemix, no "pkg_add" isn't rly secure, cause it won't compile the mysql files, so if the host uses modified kernels it could be, that the mysql bin doesn't work anymore with this kind of install!

    @Rumor, please don't give the external mysql users grant option... that's evil and not rly safe! You additionaly shouldn't give the M2 User grant option, cause, FOR WHAT HE SHOULD NEED IT?! Hacking database, if u useing a modified game/db core with evil backdoor functions?

     

    And for the Web-server ... I personally am of the opinion, FreeBSD isn't an OS for webhosting... I often had problems cause of missing pkg's or s.th. else... 

     

    Kind regards

    • Love 2
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.