• Hi all gurus,
    please forgive the noobyness, I’m really new to WordPress …
    Shortly: a friend of mine has got a wp site that has been hacked through a php shell.
    Obviously, he didn’t have a backup and the person who did his site is a freelance webdesigner who’s actually disappeared…

    He asked me an help to start his site from scratch, and… well, here I am.
    I performed a clean installation of wordpress, applied some security measures, installed his previous theme (a payment one). So far, so good.

    But… in order to render the look & feel similar, if not identical, to the hacked site, I would like to setup the “hacked” site locally.
    I found this guide:

    https://codex.www.ads-software.com/Test_Driving_WordPress#Installing_an_Existing_WordPress_Site

    And tried to follow it step-by-step, assured that I have a full FTP dump of the site after the attack (and cleansing procedure) as well as the access to its DB.

    The problem is when I try to import the db using phpMyAdmin integrated in XAMPP.
    As far as I’ve seen, the MySQL db of the site was made of two tables:
    information schema
    <sitename>_com_one
    As seen in the guide, I exported the db in an SQL file and lately, I replaced in this file all the instances of URL “https://www.sitename.com&#8221; with “https://localhost/sitename.com&#8221;.

    When I tried to import the sql file in XAMPPP’s MyPHPAdmin I initially had a problem on the first row:

    SET SQL_MODE=”NO_AUTO_VALUE_ON_ZERO”;

    Hence, I commented it, but again the import stucks at the following row:

    CREATE DATABASE information_schema DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;

    I commented also this row, given that “information schema” is a DB table which is already available by default in the MySQL db integrated in XAMPPP.

    New import trial: this time I had an error on

    USE information_schema;

    Tried to comment also this entry, but then I had the error on this:

    CREATE TEMPORARY TABLE CHARACTER_SETS (
    CHARACTER_SET_NAME varchar(32) NOT NULL DEFAULT ”,
    DEFAULT_COLLATE_NAME varchar(32) NOT NULL DEFAULT ”,
    DESCRIPTION varchar(60) NOT NULL DEFAULT ”,
    MAXLEN bigint(3) NOT NULL DEFAULT ‘0’
    ) ENGINE=MEMORY DEFAULT CHARSET=utf8;

    At this time I stopped commenting as it’s clear the problem is elsewhere.
    Could anyone help me out with this task?
    Thanks in advance,
    kind regards!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Do NOT import the information_schema database into the local install. That is used by MySQL internally and will/should have been created when MySQL was first install on the local server. All you need is the <sitename>_com_one database.

    Thread Starter k4yl0rd

    (@k4yl0rd)

    Thanks Esmi,
    I’ll try asap… But the issue remains, as the fails @

    CREATE TEMPORARY TABLE CHARACTER_SETS (
    CHARACTER_SET_NAME varchar(32) NOT NULL DEFAULT ”,
    DEFAULT_COLLATE_NAME varchar(32) NOT NULL DEFAULT ”,
    DESCRIPTION varchar(60) NOT NULL DEFAULT ”,
    MAXLEN bigint(3) NOT NULL DEFAULT ‘0’
    ) ENGINE=MEMORY DEFAULT CHARSET=utf8;

    so, apart from exporting the only <sitename>_com_one database and redo the substitutions with my local path, I assume this problem will still persist.
    Do you agree?
    In the meantime, thanks for your support ??

    Sorry – I’m a little lost. Have you managed to successfully import a copy of the site database? Did you run a suitable search & replace script on a copy of the site db before trying to import? What – if anything – is your current problem?

    Did you export your all your databases? You should only export the database with your WordPress content. You can check this in the wp-config.php file located in the root of your WordPress folder.

    Export just that database, and import into your localhost do this before you begin search/replace of anything. Once done, let us know and we’ll guide you through the rest.

    Thread Starter k4yl0rd

    (@k4yl0rd)

    Hi guys, here I am, sorry I had no chance to try your suggestion before this evening…
    So… I did as you told me, exporting only the relevant tables from the original site (excluding for instance “information_schema”).
    Then I copied my dump of the folder https://www.mysite.com into xampp/htdocs/mysite.com, and replaced the string https://www.mysite.com in the SQL file with https://localhost/mysite.com (I hope i replaced correctly, the guide is a bit ambiguous on that imho).

    Anyway, I started phpMyAdmin from xamppp, created a DB with the name I found in wp_config.php (mysite_com_one).
    I tried then to import but the procedure didn’t finished correctly; only three tables out of 21 were created, then a dump is raised with the following message:

    Error
    Static analysis:
    1 errors were found during analysis.
    Unrecognized keyword. (near “ON” at position 25)
    SQL query: Edit Edit

    SET FOREIGN_KEY_CHECKS = ON;

    MySQL said: Documentation

    #2006 – MySQL server has gone away

    I tried to check the SQL file to find that statement “SET FOREIGN_KEY_CHECKS” but unfortunately, I didn’t find any occurrence.

    What am I doing wrong?

    In the meantime, thanks for your patience and support ??

    Thread Starter k4yl0rd

    (@k4yl0rd)

    Hello everyone,
    the original issue has been solved.
    I had to modify the parameter upload_max_size in php.ini (located in XAMPP\php), then the import has been performed successfully ??

    Now… I don’t understand why I can’t access the site.
    The site has been copied in
    C:\xampp\htdocs\mysite.com
    Hence, starting XAMPP, I started both the instances of Apache and MySQL (both are highlighted in green).
    However, opening the browser at the following URL:
    https://127.0.0.1/mysite.com/index.php
    I don’t get any error but the page
    https://127.0.0.1/dashboard/
    is opened (it’s the XAMPP dashboard).

    What’s wrong here?

    Thanks for your help ??

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Migration of an existing (hacked) site locally’ is closed to new replies.